-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Add lock and null check to remoting internals (#16542) #16683
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
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@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
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).