Skip to content

Conversation

@PaulHigin
Copy link
Contributor

These are two fixes for random hangs found internally.

The first fix (job.cs) is for data stream Close calls on PSDataCollection objects because the method also raises public events. If an exception is thrown on the event handler then the thread never completes job clean up causing a hang. Fix is to catch all thrown exceptions and report.

The second (invokecommandcommand.cs) fixes a hang scenario where a remote job goes into disconnected state while simultaneously handling an exception. Fix is to use try/finally pattern to ensure Invoke-Command can always complete with jobs in the disconnected state.

@PaulHigin PaulHigin added the WG-Remoting PSRP issues with any transport layer label Oct 27, 2017
@PaulHigin PaulHigin removed the request for review from mirichmo October 31, 2017 15:28
@adityapatwardhan
Copy link
Member

@PaulHigin Is it possible to add tests for this?

@PaulHigin
Copy link
Contributor Author

@adityapatwardhan No, not safely. The code closes all opened runspaces when an "interactive host" runspaces closes, which unfortunately includes Pester runspaces.

@PaulHigin
Copy link
Contributor Author

@adityapatwardhan Whoops, I though this was referring to the recent PowerShell hang on exit issue. But again, the answer is not to tests since this is fixing rare random hangs. I might be able to add test hooks, but I don't know if it is worth it.

@SteveL-MSFT
Copy link
Member

We should just take this PR into account when we develop reliability specific tests as part of #4008

@adityapatwardhan adityapatwardhan merged commit 73188ce into PowerShell:master Nov 10, 2017
@PaulHigin PaulHigin deleted the port-hang-fixes branch January 23, 2018 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WG-Remoting PSRP issues with any transport layer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants