Repository navigation
fix: keep drive names and temperatures only from a disk read that worked - #3151
Merged
Merged
Conversation
Closes #2782. DiskHealthService returned what it had read before a fault, with nothing to say it had failed, so TemperatureService kept a failed read as the drives: the names for the session, the non-elevated temperatures for 30 seconds. ReadAsync now returns a DiskHealthRead with the fault, both caches take only a complete read, the dead catches go, and a run of failed reads is logged once. The Win32_DiskDrive name prefetch asked WMI for ORDER BY, which WQL does not have, so it failed on every elevated poll and never named a drive. It is removed, and an ArchitectureTests guard rejects ORDER BY in any WMI query. System Health's SMART check says a failed read failed instead of "Collected 0 disk report(s).".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2782.
What changes for a user
SELECT Model FROM Win32_DiskDrive ORDER BY Index. WQL has no ORDER BY, so WMI refused the query as invalid at every refresh, and SysManager logged each refusal. It never named a drive in any release since 1.17.0. It is removed.How
DiskHealthService.ReadAsyncreturns aDiskHealthRead: the drives, and the fault that stopped the read, or null when it finished.CollectAsyncstill returns the drives alone for its callers (health score, Tune-up, the report), which judge each drive and already count an empty list as not checked. A run of failed reads is logged once, the wayNvidiaGpuReaderlogs, and after a read succeeds the next failure is logged again. An internal constructor takes the read and the log, so a test can make a read fail.TemperatureService.EnrichStorageNamesAsynccaches names only from a complete read and names nothing on a failed one.ReadDiskTemperaturesAsyncshows a failed read's drives for that refresh but caches only a complete one. Its three catches, for exceptionsDiskHealthServicenever lets out, are gone. Both methods are internal for the tests.GetDiskNamesFromWmiand its cache are gone, andReadHardwaretakes no name list. A drive LibreHardwareMonitor cannot name is "Drive N", and the enricher names it, as it already did. The prefetch paired names by position anyway, and a drive with no temperature sensor adds no reading, so if the query had worked, each drive after one like that would have shown the previous drive's model.SystemHealthViewModel.DescribeDiskReadwrites the status line. The catch forManagementExceptionorCOMExceptioncould never run and is gone.ArchitectureTests.NoWmiQuery_SortsWithOrderByscans the app's code, comments left out, forORDER BY. It also checks that at least 20 WMI queries were read, so an empty scan cannot pass.Tests
TemperatureServiceMemoizeTests, which was written on the opposite premise, that an empty result from a failed read was "still a valid, cached resolution".DiskTemperatureTtland read again one second later. Before this the TTL could not be reached from a test.DiskHealthService: three failures, a success and a failure log twice; a read that works logs nothing;CollectAsyncstill returns the drives of a read cut short. System Health: a failed check's status, and both wordings ofDescribeDiskRead.ReadHardware: a drive LibreHardwareMonitor cannot name is a numbered placeholder.Red before the fix, by mutation, each restored byte for byte afterwards:
DescribeDiskRead.ORDER BYin a real query: the new guard fails.Checks
dotnet format --verify-no-changesis clean.DiskHealthServiceTestsagainst real WMI.DiskHealthService,TemperatureService) are in this pull request.