FanControl.Releases icon indicating copy to clipboard operation
FanControl.Releases copied to clipboard

Window never appears and process can't be killed: startup storage enumeration blocks forever on a wedged USB device

Open Zafer-Liu opened this issue 2 months ago • 0 comments

Describe the bug

FanControl V281 stops showing its window while the backend/engine keeps running. Once it happens the process is a zombie: clicking does nothing, the tray/IPC backend still responds, and the process often cannot be killed (TerminateProcess fails; only unplugging/disabling the failing USB device releases it).

Root cause, proven with a dotnet-dump of the hung process: a malfunctioning USB storage device makes a DeviceIoControl never complete, and FanControl performs LHM/DiskInfoToolkit storage enumeration synchronously on the WPF UI thread during startup, so the whole frontend never comes up.

Verbatim evidence (clrstack -all, UI thread)

DiskInfoToolkit.Native.Kernel32Native.DeviceIoControl(...)
DiskInfoToolkit.Core.WindowsStorageIoControl.SendRawIoControl(...)
DiskInfoToolkit.Core.WindowsStorageIoControl.TryGetDriveGeometryEx(...)
DiskInfoToolkit.Core.StorageDetectionEngine.AttachStandardStorageProperties(...)
DiskInfoToolkit.Core.StorageDetectionEngine.GetDisks()
DiskInfoToolkit.Storage.EnumerateRawDisks()
DiskInfoToolkit.Storage.GetDisks()
LibreHardwareMonitor.Hardware.Storage.StorageGroup.AddHardware(...)
LibreHardwareMonitor.Hardware.Storage.StorageGroup..ctor(...)
LibreHardwareMonitor.Hardware.Computer.AddGroups()
LibreHardwareMonitor.Hardware.Computer.Open()
FanControl.Domain.BackendProviders.LHM.LHMBackendProvider.Open()
FanControl.Domain.ComputerAccessLayer.Initialize()
FanControl.Bootstrap.<EnterFullAppMode>d__31.MoveNext()
System.Windows.Threading.Dispatcher.ProcessQueue()        <-- UI thread, forever

The stuck thread is blocked in kernel inside the driver, which is why the process cannot be terminated.

Environment

  • FanControl V281 (clean full install), Windows 11 Pro 26200, engine+UI same process.
  • Trigger hardware: Realtek USB card reader bridge USB\VID_0BDA&PID_9210 with a Samsung portable SSD ("MZ9L4256 HCJQ-00BMV-SAMSU USB Device") that started failing — Event Log full of disk event 11 (controller error) / Ntfs 140 for that device.
  • Same failure signature as #3759 (USB floppy adapter) and related to #4011: any storage device whose driver wedges an IRP will do it. LHM's periodic storage refresh can hang a long-running instance the same way.

Workaround

Either of these restores the UI immediately:

  • Disable storage monitoring: userConfig.json → LibreHardwareMonitorSettings → "Storage": false (note: Sensors.DisableStorageSensors alone does not stop enumeration), or
  • Disable/unplug the failing USB device (Device Manager → disable the USB parent of the disk).

Fix status

Upstream library fix submitted: Blacktempel/DiskInfoToolkit#21 — adds a timeout + per-device cooldown to the raw IOCTL path (SendRawIoControl), so a wedged device is skipped after 30 s instead of hanging enumeration forever. Once merged, released, and picked up by LibreHardwareMonitor/FanControl, this class of hang disappears at the library level.

Suggested FanControl-side hardening (independent of the above): don't run Computer.Open()'s storage enumeration synchronously on the UI thread during EnterFullAppMode — a slow/hung device currently blocks the first paint indefinitely even after the library fix (it would just become a 30 s stall instead of forever).

Side note observed during the same incident: when two instances race on startup, log.txt is locked by the running instance and the new frontend dies via an unhandled DispatcherUnhandledException (IOException) — unrelated to the hang but it makes diagnosis confusing since it looks like the same "window never appears" symptom.

Zafer-Liu avatar Sep 28 '26 07:09 Zafer-Liu