Add lock and null check to remoting internals (#16542)#16683
Add lock and null check to remoting internals (#16542)#16683PaulHigin merged 3 commits intoPowerShell:masterfrom
Conversation
|
I am not comfortable adding extra locks here and possibly introducing deadlocks. This code has remained untouched for many years. We need to better understand of the race condition, @SergeyZalyadeev please add scenario information. The SerializedDataStreams already handle the dispose condition, and this may need to be extended for this particular scenario. |
|
@PaulHigin please take a look on the issue #16542 Dumps |
PaulHigin
left a comment
There was a problem hiding this comment.
@SergeyZalyadeev Thanks for the scenario information and crash dumps. I agree with your analysis and fix, and have just a few minor comments. I would like to get this change in to 7.3 preview asap, after you make these minor fixes, so that the change can be well tested.
src/System.Management.Automation/engine/remoting/fanin/PriorityCollection.cs
Show resolved
Hide resolved
src/System.Management.Automation/engine/remoting/fanin/PriorityCollection.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/remoting/fanin/PriorityCollection.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/remoting/fanin/PriorityCollection.cs
Outdated
Show resolved
Hide resolved
|
@daxian-dbw Can you please review? I would like to get a second set of eyes on this change. |
src/System.Management.Automation/engine/remoting/fanin/PriorityCollection.cs
Outdated
Show resolved
Hide resolved
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
src/System.Management.Automation/engine/remoting/fanin/PriorityCollection.cs
Show resolved
Hide resolved
|
@SergeyZalyadeev Thanks for your contribution! |
|
@PaulHigin this was merged without the cla signed |
|
@SergeyZalyadeev Can you please sign the CLA? https://cla.opensource.microsoft.com/PowerShell/PowerShell?pullRequest=16683 |
…erShell#16683) * fix crash Copy-Item to remote session (PowerShell#16542) * update comments * remove lock (PowerShell#16542) Co-authored-by: Sergey Zalyadeev <sergey.zalyadeev@cayosoft.com>
|
🎉 Handy links: |
…erShell#16683) * fix crash Copy-Item to remote session (PowerShell#16542) * update comments * remove lock (PowerShell#16542) Co-authored-by: Sergey Zalyadeev <sergey.zalyadeev@cayosoft.com>
PR Summary
Lock and null check of the PrioritySendDataCollection.cs members to avoid race condition.
PR Context
Copy-Item cmdlet can throw unhandled exception that terminates the process.
The issue occures in WSManTransportManager internals.
The PrioritySendDataCollection class is used by 2 threads: first thread calls ReadOrRegisterCallback method, that gets _dataToBeSent field, when second thread calls Clear method, where _dataToBeSent member is disposed.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).