Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close Thread Handle after thread join on Windows #1595

Merged
merged 2 commits into from Jan 26, 2015

Conversation

markbenvenuto
Copy link
Contributor

On Windows after a thread exits, there is still one last remaining reference to the thread handle, and a program is required to call CloseHandle to free the last reference otherwise there is handle leak. The last reference allows thread creators to check on the status of thread, etc.

Fixes SERVER-17025

@wtbuild
Copy link

wtbuild commented Jan 23, 2015

Test PASSed.


WT_RET_MSG(session, ret, "WaitForSingleObject");
return (0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@markbenvenuto:

  • Should we do something with "ret", maybe use it as the second argument to the WT_PANIC_RET call so we get an idea why WaitForSingleObject failed? If not, then I think we can remove the use of ret in this function.
  • Also, it looks to me like CloseHandle can fail (see here), should we check and panic in that case as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keithbostic

  1. Good suggestion. I was unsure what to pass to WT_PANIC in this case for that argument.
  2. I cleaned up CloseHandle in this function, and everywhere else.

@keithbostic keithbostic added this to the 2.5.1 milestone Jan 24, 2015
@keithbostic keithbostic self-assigned this Jan 24, 2015
@wtbuild
Copy link

wtbuild commented Jan 26, 2015

Test PASSed.

@keithbostic
Copy link
Contributor

This looks great, @markbenvenuto, thank you, I'll merge.

keithbostic added a commit that referenced this pull request Jan 26, 2015
Close Thread Handle after thread join on Windows
@keithbostic keithbostic merged commit 2e3f764 into wiredtiger:develop Jan 26, 2015
@keithbostic keithbostic added Bug and removed Bug labels Jan 26, 2015
@agorrod agorrod added Done Fixed and removed Done labels Apr 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants