Commit 6772529
Make dictionaries concurrent in NodeProvideOutOfProcTaskHost (#12708)
Fixes #12660
### Context
The following assert fails:
`/mt /m` sometimes crashes with error:
```
Microsoft.Build.Framework.InternalErrorException: MSB0001: Internal MSBuild Error: Why are we trying to disconnect from a context that we already disconnected from? Did we call DisconnectFromHost twice?
at Microsoft.Build.Shared.ErrorUtilities.ThrowInternalError(String message, Exception innerException, Object[] args) in C:\Users\alinama\work\msbuild\src\Shared\ErrorUtilities.cs:line 69
at Microsoft.Build.Shared.ErrorUtilities.VerifyThrow(Boolean condition, String unformattedMessage) in C:\Users\alinama\work\msbuild\src\Shared\ErrorUtilities.cs:line 195
at Microsoft.Build.BackEnd.NodeProviderOutOfProcTaskHost.DisconnectFromHost(Int32 nodeId) in C:\Users\alinama\work\msbuild\src\Build\BackEnd\Components\Communications\NodeProviderOutOfProcTaskHost.cs:line 607
at Microsoft.Build.BackEnd.TaskHostTask.Execute() in C:\Users\alinama\work\msbuild\src\Build\Instance\TaskFactories\TaskHostTask.cs:line 382
at Microsoft.Build.BackEnd.TaskExecutionHost.Execute() in C:\Users\alinama\work\msbuild\src\Build\BackEnd\TaskExecutionHost\TaskExecutionHost.cs:line 636
```
### Changes Made
Changed `_nodeIdToPacketFactory` and `_nodeIdToPacketHandler` from
`Dictionary` to `ConcurrentDictionary`.
### Testing
Manually tested to make sure the error is not there.
### Notes
---------
Co-authored-by: Jan Provazník <[email protected]>1 parent 895abae commit 6772529
File tree
1 file changed
+11
-7
lines changed- src/Build/BackEnd/Components/Communications
1 file changed
+11
-7
lines changedLines changed: 11 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
89 | 91 | | |
90 | | - | |
| 92 | + | |
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
| 96 | + | |
| 97 | + | |
94 | 98 | | |
95 | | - | |
| 99 | + | |
96 | 100 | | |
97 | 101 | | |
98 | 102 | | |
| |||
208 | 212 | | |
209 | 213 | | |
210 | 214 | | |
211 | | - | |
212 | | - | |
| 215 | + | |
| 216 | + | |
213 | 217 | | |
214 | 218 | | |
215 | 219 | | |
| |||
602 | 606 | | |
603 | 607 | | |
604 | 608 | | |
605 | | - | |
| 609 | + | |
| 610 | + | |
606 | 611 | | |
607 | | - | |
608 | | - | |
| 612 | + | |
609 | 613 | | |
610 | 614 | | |
611 | 615 | | |
| |||
0 commit comments