Skip to content

Widget stops to refresh after a while #17

Open

Description

@F0x06

Version

3.0.9513.23260 X64

OS

Windows 11 Pro 25H2 26200.8037

What is wrong?

I’ve been experiencing a strange issue: after some time, both the widget and app stops refreshing randomly, and I have to restart the application to get it working again.

What did you try already?

Hi! First of all, thanks for this really cool tool.

I’ve been experiencing a strange issue: after some time, both the widget and app stops refreshing randomly, and I have to restart the application to get it working again.

Is anyone else experiencing this problem?

If needed, I’m happy to provide additional information. Thanks!

Image

How to reproduce the bug?

Seems to be random

What is the behavior that you expected?

Normal data update.

Logs

.

Additional information

No response

Activity

  1. sergiye commented on Apr 16, 2026

    @sergiye
    Collaborator

    hi @F0x06,
    I need steps to reproduce, perhaps you can trace some pattern?

  2. F0x06 commented on Apr 18, 2026

    @F0x06
    Author

    Hi, for now seems random, its actually frozen at time of writing this message, still trying to find a reproducer.

    PS: Doing file -> Exit on main window, the widget stays on screen i had to kill the process.

  3. F0x06 commented on Jul 14, 2026

    @F0x06
    Author

    Note: the analysis below was produced with Claude Code (Anthropic's CLI agent). I caught my own instance frozen and had Claude drive a live memory dump of it, read the managed thread stacks, and correlate them with the OHM / RAMSPDToolkit / BlackSharp sources. I've reviewed the findings; sharing them here in full so they're useful to whoever picks this up.

    Root cause found — infinite wait on the global SMBus mutex during the DDR4 SPD read

    I caught the app in the frozen state and took a full memory dump while it was still hung (process left running, not killed), then read the managed thread stacks and cross-checked them against the source. The freeze is not random: the update thread is stuck forever on a global SMBus/PCI mutex during the DDR4 SPD temperature read, because that mutex is acquired with an infinite timeout.

    Managed stack of the frozen BackgroundWorker thread

    This was the only thread holding locks (Lock Count 2) and it never returns:

    Kernel32.WaitForSingleObject(...)                          <- BLOCKED, INFINITE
    BlackSharp.Core.Interop.Windows.Mutexes.WorldMutex.Lock()  <- global mutex, no timeout
    RAMSPDToolkit.I2CSMBus.SMBusI801.I2CSMBusXfer(...)
    RAMSPDToolkit.I2CSMBus.SMBusInterface.i2c_smbus_read_word_data_swapped(...)
    RAMSPDToolkit.SPD.DDR4Accessor.UpdateTemperature()
    OpenHardwareMonitor.Hardware.Memory.Sensors.SpdThermalSensor.UpdateSensor()
    OpenHardwareMonitor.UI.UpdateVisitor.VisitHardware(...)
    OpenHardwareMonitor.Hardware.Computer.Accept(...)
    OpenHardwareMonitor.UI.MainForm.BackgroundUpdater_DoWork(...)
    

    The exact cause

    SMBusI801.I2CSMBusXfer takes two global mutexes, SMBus then PCI:

    using (new WorldMutexGuard(WorldMutexManager.WorldSMBusMutex))   // Global\Access_SMBUS.HTP.Method
    using (new WorldMutexGuard(WorldMutexManager.WorldPCIMutex))     // Global\Access_PCI
        i801Access(...);

    and WorldMutex.Lock() (in BlackSharp.Core) waits with no timeout:

    public void Lock() {
        if (_WorldMutex != IntPtr.Zero)
            Kernel32.WaitForSingleObject(_WorldMutex, INFINITE_TIME);  // 0xFFFFFFFF
    }

    Both mutexes are Global\ and shared system-wide. Global\Access_PCI in particular is the same kernel object OHM uses in its own Mutexes.cs, and the same one LibreHardwareMonitor / HWiNFO / RGB software / vendor tools use. So the moment any other process (or a stalled bus transaction) holds that mutex and doesn't release it promptly, the SPD read blocks — and because the wait is infinite, a transient bit of contention turns into a permanent freeze. This is why it triggers "randomly, after a while": it depends on external SMBus/PCI mutex timing.

    Note the asymmetry: OHM's own Mutexes.cs (ISA / PCI / EC / Razer / USB) always waits with a finite WaitOne(timeout) (10 ms–5 s) and pairs every acquire with a release. The RAMSPDToolkit → BlackSharp WorldMutex path is the only hardware access in the process that can wait forever.

    Why the whole app freezes (not just the RAM values)

    MainForm.Timer_Tick only kicks off a new update if (!backgroundUpdater.IsBusy), and a single BackgroundWorker iterates over all hardware via _computer.Accept(_updateVisitor). Once the SPD read hangs, that worker never completes → IsBusy stays true forever → no sensor is ever updated again. The timer keeps calling treeView.Invalidate() / _gadget?.Redraw() / _systemTray.Redraw(), which just repaint the last-known values, so the window stays fully responsive while every number (and the web widget, served from the same in-memory values) is frozen.

    Confirmation

    Unchecking the RAM menu item (Computer.IsMemoryEnabled = false, which removes the MemoryGroup and stops the SPD reads) recovered the app: it stalled for ~15 s, then resumed refreshing normally — matching the theory that the mutex was eventually released and that the memory/SPD path is the trigger.

    Suggested fix

    1. Real fix (at the source): make WorldMutex.Lock() accept a finite timeout and have I2CSMBusXfer skip the transaction (return failure) when the mutex can't be acquired in time, instead of blocking forever. This is the single change that actually prevents the hang. Lives in RAMSPDToolkit-NDD / BlackSharp.
    2. Defense in depth (in OHM): decouple the memory/SPD update from the shared BackgroundWorker (dedicated worker, or a watchdog that doesn't keep IsBusy latched) so one wedged bus read can't stop CPU/GPU/mainboard refresh.

    A thread stuck in a native WaitForSingleObject cannot be aborted from managed code, so only the finite timeout at the acquisition point (1) truly fixes it; (2) only limits the blast radius.


    Diagnosed by capturing a full user-mode dump of the frozen process (dotnet-dump collect -p <PID>), reading the managed stacks (dotnet-dump analyze → clrthreads + clrstack -all), and cross-checking against OHM / RAMSPDToolkit / BlackSharp sources — with the help of Claude Code (Anthropic's CLI agent) to drive the capture and correlate the stacks with the code.

  4. sergiye commented on Jul 15, 2026

    @sergiye
    Collaborator

    Please post a issue with a detailed description of this situation in the RAMSPDToolkit repository

    as for now - decoupling the memory/SPD update from the main update flow does not fit the current application architecture, so lets wait for fix in RAMSPDToolkit

  5. Blacktempel commented on Jul 16, 2026

    @Blacktempel
    Contributor

    Will be in next version of RAMSPDToolkit.

  6. F0x06 commented on Jul 16, 2026

    @F0x06
    Author

    For anyone hitting this: on my machine the freeze was triggered by Corsair iCUE — the Corsair.Service.exe service polls the SMBus continuously and holds the global SMBus mutex, which RAMSPDToolkit waits on with no timeout. Stopping the Corsair service stops the freeze (closing the iCUE app alone isn't enough).

    Root cause and fix are tracked upstream in Blacktempel/RAMSPDToolkit#10 — a finite mutex timeout is already committed and will ship in the next RAMSPDToolkit release.

  7. added a commit that references this issue on Jul 28, 2026
  8. sergiye commented on Jul 28, 2026

    @sergiye
    Collaborator

    @F0x06 Please check the fix in the version 3.0.9705

  9. F0x06 commented on Aug 19, 2026

    @F0x06
    Author

    Hi ! Sorry for the late reply, i will check and give feedback, thanks ! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions