Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix for race bug in WSMan command plugin instance close operation#3203

Merged
daxian-dbw merged 1 commit into
PowerShell:masterPowerShell/PowerShell:masterfrom
PaulHigin:RaceFixCopy head branch name to clipboard
Feb 27, 2017
Merged

Fix for race bug in WSMan command plugin instance close operation#3203
daxian-dbw merged 1 commit into
PowerShell:masterPowerShell/PowerShell:masterfrom
PaulHigin:RaceFixCopy head branch name to clipboard

Conversation

@PaulHigin

Copy link
Copy Markdown
Contributor

This fixes a rare race condition that can crash the WinRM service when remote sessions are closing.
From the crash stack dump it is clear that the exception comes from a SetThreadProperties call that references an invalid unmanaged data handle which was previously released. The data handle is released when the plugin command instance is closed and the error occurs when two threads contend to close the same object.

The close command and close session operations are designed to be multi-thread safe, but the SetThreadProperties call is done before the atomic check is performed. The fix is to move the SetThreadProperties call after the atomic check to ensure it is only called when the object is in the opened state.

@daxian-dbw daxian-dbw merged commit 136213d into PowerShell:master Feb 27, 2017
@PaulHigin PaulHigin deleted the RaceFix branch February 28, 2017 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.