Opened 16 years ago

Closed 16 years ago

#808 closed Defect (fixed)

Core client leaks thread handles on Windows

Reported by: Nicolas Owned by: davea
Priority: Minor Milestone: Undetermined
Component: Client - Daemon Version: 6.2.19
Keywords: Cc:

Description

This BOINC client started 47 hours ago (on a reboot). Process Explorer shows boinc.exe has almost 270 thread handles open. Of those, 5 are handles for threads of the client itself. All the rest are invalid handles. Procexp shows lines like "<Non-existent process>(960): 3432", where 960 is the PID (not matching any current process) and 3432 is the thread ID in that process.

This seems to be a handle leak when BOINC starts science apps.

Change History (3)

comment:1 Changed 16 years ago by Nicolas

Windows API documentation for CreateProcess and CreateProcessAsUser say: "Handles in PROCESS_INFORMATION must be closed with CloseHandle when they are no longer needed."

The PROCESS_INFORMATION structure contains both thread and process handles.

ACTIVE_TASK::cleanup_task in app.cpp is closing the process handle but not the thread handle. In fact, the thread handle is not stored by ACTIVE_TASK::start anywhere, so there is no way cleanup_task could close it.

comment:2 Changed 16 years ago by Nicolas

Summary: BOINC 6.2 leaks thread handlesCore client leaks thread handles on Windows

I have only tested 6.2.19, but the relevant code in trunk doesn't seem to have changed, so I assume it happens on all versions.

comment:3 Changed 16 years ago by davea

Resolution: fixed
Status: newclosed

(In [16743]) - client, Win: don't leak thread handlers

fixes #808

Note: See TracTickets for help on using tickets.