ArcadeRenegade / SidebarDiagnostics

A simple sidebar for Windows desktop that displays hardware diagnostic information.
GNU General Public License v3.0
2.29k stars 201 forks source link

SidebarDiagnostics may leak 150k+ handles per second with buggy hardware #376

Open ntoskrnl4 opened 2 years ago

ntoskrnl4 commented 2 years ago

Related to #335 (SystemIO error with NZXT Kraken coolers). I suspect that updating LibreHardwareMonitor may have fixed this (commit 6ec64ef), though you haven't yet got binaries for that available (0d330d4).

I have SidebarDiagnostics in my startup items, and I noticed today that SidebarDiagnostics was leaking a ludicrous number of handles per second (150k/sec). It reached 16711675 (0xfefffb) handles before crashing (presumably running out of handles) with the same errors as outlined in #335, which is what clued me in on this.

Task Manager showing 5 million handles open on the system

Task Manager's details view showing SidebarDiagnostics as the process with 10 million open handles

Task Manager's details view showing the SidebarDiagnostics process having 16, 711, 675 handles open, with SidebarDiagnostics showing a crash message.

Running the handle tool shows they are event handles, which indeed is mentioned by some of the errors generated when it crashes, both here and in #335.

The "handle" tool, showing SidebarDiagnostics as having 587 thousand open event handles.

I tried following @/randomascii's handle leak article to try and find the source, but since I don't have symbols or anything (and I'm not really a developer), it didn't get anywhere useful.

Windows Performance Analyzer showing a breakdown of handle creation stack, with no stack information in userspace

Hopefully this can help somehow though. This program is one of my favorites and I'd really like to keep using it.

ArcadeRenegade commented 2 years ago

Hey thanks for the detailed report. The only handles used in the apps code are for the Windows kernel interop for ui stuff like app bar, flag always on top, etc. but I don't think that's causing this. More likely caused by LibreHardwareMonitor. I am testing a new build with the latest commit of LibreHardwareMonitor. Can you try it?

https://github.com/ArcadeRenegade/SidebarDiagnostics/issues/349#issuecomment-974712027

ntoskrnl4 commented 2 years ago

Oh dang, I think that fixes it. Before, I was able to pretty consistently trigger it by reloading it from the taskbar; with that version I've been able to start it, reload, change settings, etc for a couple of minutes without it going haywire. I'll keep an eye on it, but I think that's all was needed.

ArcadeRenegade commented 2 years ago

Cool there's a bug with gpu fans I have to fix but after I'll release it.

ntoskrnl4 commented 2 years ago

Haven't had any issues at all with that development build you linked, so I'm gonna close this since it seems like you've already got the issue resolved. Thanks for your work!

ArcadeRenegade commented 2 years ago

I'll keep it open for now until I release thx

ArcadeRenegade commented 2 years ago

Released v3.6.1 can you please test for me?

ntoskrnl4 commented 2 years ago

Working just fine! Thanks.