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

TranscriptionOption.Dispose() should be idempotent #13830

Closed
PaulHigin opened this issue Oct 21, 2020 · 0 comments
Closed

TranscriptionOption.Dispose() should be idempotent #13830

PaulHigin opened this issue Oct 21, 2020 · 0 comments
Assignees
Labels
Issue-Bug Issue has been identified as a bug in the product WG-Engine core PowerShell engine, interpreter, and runtime

Comments

@PaulHigin
Copy link
Contributor

Crash dumps have shown that Runspace.Close() operation can crash a process if the final two runspaces of a session are closed at the same time. This is because a transcription may be closed/disposed by two separate threads, resulting in a IO or Disposed exception.

https://github.com/PowerShell/PowerShell/blob/master/src/System.Management.Automation/engine/hostifaces/MshHostUserInterface.cs#L1176

The Dispose method should be idempotent and if the underlying writer object is disposed or file is closed, the method should not throw.

The problem was found in Windows PowerShell, but the fix (wrap in try/catch) should be applied here as well.

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.3
PSEdition                      Core
GitCommitId                    7.0.3
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
@PaulHigin PaulHigin added Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a Issue-Bug Issue has been identified as a bug in the product labels Oct 21, 2020
@PaulHigin PaulHigin self-assigned this Oct 21, 2020
@iSazonov iSazonov added WG-Engine core PowerShell engine, interpreter, and runtime and removed Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a labels Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug Issue has been identified as a bug in the product WG-Engine core PowerShell engine, interpreter, and runtime
Projects
None yet
Development

No branches or pull requests

2 participants