8000 Fix race condition exception on recent change to OutOfProc transport by PaulHigin · Pull Request #11406 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@PaulHigin
Copy link
Contributor

PR Summary

This PR fixes an exception thrown during a race condition in the OutOfProc transport base class, when a session is closed but command data is still being processed on the client.

PR Context

A recent change to the OutOfProc transport base class, adds separate processing threads for command and session messages. The processing threads are ended by setting the message BlockingCollection objects to complete. But this is done at session close when there can still be command data messages to process, and this resulted in an InvalidOperationException error.

To fix this, two changes were made:

  1. Try/catch added to handle any late coming message events.
  2. Move the message queue object completion to Dispose() method, to ensure message processing is closed at the very end of the transport lifetime.

PR Checklist

@ghost ghost assigned TravisEz13 Dec 19, 2019
@PaulHigin PaulHigin added the Issue-Bug Issue has been identified as a bug in the product label Dec 19, 2019
@anmenaga anmenaga added this to the 7.1.0-preview.1 milestone Dec 20, 2019
@anmenaga anmenaga added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Dec 20, 2019
@anmenaga anmenaga merged commit e58ebfa into PowerShell:master Dec 20, 2019
@PaulHigin PaulHigin deleted the fix-outofproctrans-closesession-race branch December 20, 2019 21:32
@daxian-dbw daxian-dbw modified the milestones: GA-approved, 7.0.0-rc.2 Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log Issue-Bug Issue has been identified as a bug in the product

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

0