-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Open
Labels
area-System.Diagnostics.Processneeds-further-triageIssue has been initially triaged, but needs deeper consideration or reconsiderationIssue has been initially triaged, but needs deeper consideration or reconsideration
Milestone
Description
Description
Method GetWaitState() may be entered my multiple threads (it's not guarded by a lock) and each thread can return different instance of the ProcessWaitState, which is mutable.
runtime/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs
Lines 955 to 962 in 97f5045
| { | |
| if (_waitStateHolder == null) | |
| { | |
| EnsureState(State.HaveId); | |
| _waitStateHolder = new ProcessWaitState.Holder(_processId); | |
| } | |
| return _waitStateHolder._state; | |
| } |
When using Process.Kill in dotnet-watch we observed that the method sometimes failed to terminate process on Linux. It is plausible that this is due to the above race condition.
Reproduction Steps
n/a
Expected behavior
All methods of Process type should be thread safe.
Actual behavior
Race conditions
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
Metadata
Metadata
Assignees
Labels
area-System.Diagnostics.Processneeds-further-triageIssue has been initially triaged, but needs deeper consideration or reconsiderationIssue has been initially triaged, but needs deeper consideration or reconsideration