Handle count

Started by Pepo, November 23, 2009, 06:29:22 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Pepo

I've just noticed thet my TThrottle 1.71 is using an incredible number of handles: according to Process Manager, after a week of runtime (and consuming 3:50 hours of kernel time and 1:02 hours of user time) it uses 1 330 535 Handles, 102 GDI Handles, 261 USER Handles. (For those unaware - just 10 apps on my system use more than 1000 handles, just 4 of them between 2000 and 6000 handles.) The first number does not move, the latter two numbers oscillate around the mentioned values. I've noticed it in the Task Manager - TThrottle was consuming 10.5 MB of system's Paged Pool (maybe 15% of the whole system).

This is just an initial notice, later I'll investigate when the number of handles does go up...
Peter

Pepo

After restarting TThrottle, the handle counts stabilized around 420, 93, 252.

???

I'll check the numbers more often.
Peter

Pepo

#2
OK, as soon as TThrottle started it's primary job - throttling the processes, suddenly the handle count rose - TThrottle is leaking Thread handles, it is leaking tens (later to hundreds (later possibly to (tens of) thousands)) of handles pointnig to each and any thread of a process being throttled  :-\

Example (after just a few minutes of throttling):
minirosetta_2.00_windows_intelx86.exe(27660): 31892
References: 122
Handles: 121

minirosetta_2.00_windows_intelx86.exe(27660): 32388
References: 117
Handles: 116

primegrid_llr_5.09_windows_intelx86.exe(31824): 27324
References: 111
Handles: 109


The counts are actually nearly equal at any point in time, I just can not type that fast  :D
OK, actually it is leaking just a couple of handles per second, while throttling 5 processes, no idea how many threads in them (maybe 15-16).




This could explain resource problems I've been occasionally experiencing in the past weeks (possibly because I do rarely reboot my computer, once in a week or two).
Peter

Pepo

Quote from: Pepo on November 23, 2009, 07:32:31 PM
The counts are actually nearly equal at any point in time, I just can not type that fast  :D
OK, actually it is leaking just a couple of handles per second, while throttling 5 processes, no idea how many threads in them (maybe 15-16).

The leaking pattern (in realtime, at the moment, with possibly 16 threads being enumerated and handled) is: a group of 16 handles is leaked once in a 3-5 seconds.
Peter

fred

Something is leaking, maybe a handle of some kind.
I go hunting for them tomorrow. Shouldn't be too hard to find.... I hope.

Pepo

Quote from: fred on November 23, 2009, 07:47:24 PM
Something is leaking, maybe a handle of some kind.
Pretty exactly a Thread handle. A couple of them at once ;D

QuoteI go hunting for them tomorrow. Shouldn't be too hard to find.... I hope.
I guess so, I hope I gave you a somehow good description.

Good luck!
Peter

fred

Did someone say easy. ;D But I finally got the bug. Indeed a sort of handle, that caused a leak in the global memory.
It's the only sort of leak, the debugger doesn't complain about.
V 1.73 should solve the problem... and I added a lot of new stuff for BoincTasks.

Pepo

#7
Quote from: fred on November 25, 2009, 02:11:07 PM
But I finally got the bug. [...] V 1.73 should solve the problem...
Solved. Perfect!

Quote...and I added a lot of new stuff for BoincTasks.
Like "TThrottle 1.73: New: Integration with BoincTasks.. of local and remote hosts."? How far?

On the Options tab (or how is it actually called in English) I've tried to check "Enable BoincTasks" - what should I look for? After unchecking it, the checkboks remains disabled for some 20 seconds, it gets enabled afterwards.

After trying to start BT 0.29 for 5-6 times it merely said "Can't open some file" and terminated. Now it is finally running. Just one note (belongs to other section actually): the Graphs dlg is showing just black rounded backgrounds.

[edit]A minute later BT crashed after opening the context menu on some task. After a newstart, the graphs are displayed correctly.[/edit]
Peter

fred

Quote from: Pepo on November 25, 2009, 03:16:08 PM
Quote from: fred on November 25, 2009, 02:11:07 PM
But I finally got the bug. [...] V 1.73 should solve the problem...
Solved. Perfect!

Quote...and I added a lot of new stuff for BoincTasks.
Like "TThrottle 1.73: New: Integration with BoincTasks.. of local and remote hosts."? How far?

On the Options tab (or how is it actually called in English) I've tried to check "Enable BoincTasks" - what should I look for? After unchecking it, the checkboks remains disabled for some 20 seconds, it gets enabled afterwards.

After trying to start BT 0.29 for 5-6 times it merely said "Can't open some file" and terminated. Now it is finally running. Just one note (belongs to other section actually): the Graphs dlg is showing just black rounded backgrounds.
The TThrottle part is working and can communicate using this test tool http://www.efmer.eu/boinc/boinc_tasks/manual_net.html (Use the client to communicate with TThrottle)
The port is one above the default BOINC port.
The enable tab starts a server thread, that starts listening to someone who wants to connect.
Removing the check and the thread is ordered to quit, but that can take up to 15 seconds to complete. At that time, the check is disabled until the thread reports it has stopped. Otherwise some nasty things can happen, starting a new one while another one is quitting.
When requested it's sending an info string with all the data back.
I'm now implementing it in BoincTasks now and I hope to get a release this week.

Pepo

Peter