runtime: Compiler crashes when failing to release Mutex
Error Message
Fill the error message using step by step known issues guidance.
{
"ErrorMessage": "ReleaseMutex failed. WaitOne Id:",
"BuildRetry": true,
"ErrorPattern": "",
"ExcludeConsoleLog": true
}
Example error:
/__w/1/s/.packages/microsoft.net.compilers.toolset/3.10.0-4.21273.6/tasks/netcoreapp3.1/Microsoft.CSharp.Core.targets(71,5): error MSB3883: Unexpected exception: [/__w/1/s/src/tasks/installer.tasks/installer.tasks.csproj]
/__w/1/s/.packages/microsoft.net.compilers.toolset/3.10.0-4.21273.6/tasks/netcoreapp3.1/Microsoft.CSharp.Core.targets(71,5): error : One or more errors occurred. (ReleaseMutex failed. WaitOne Id: 14 Release Id: 14) [/__w/1/s/src/tasks/installer.tasks/installer.tasks.csproj]
Configuration: CoreCLR Product Build Linux arm64 release
cc @jkotas @jaredpar @stephentoub
Known issue validation
Build: 🔎 Result validation: ⚠️ Provided build not found. Provide a valid build in the “Build: 🔎” line. Validation performed at: 9/15/2023 5:21:46 PM UTC
Report
Build | Definition | Step Name | Console log | Pull Request |
---|---|---|---|---|
2340504 | dotnet-runtime | Build product | Log | |
495130 | dotnet/runtime | Build product | Log | dotnet/runtime#95797 |
2330640 | dotnet-runtime | Build product | Log | |
484251 | dotnet/runtime | Build product | Log | dotnet/runtime#93989 |
482435 | dotnet/runtime | Build product | Log | dotnet/runtime#95337 |
481828 | dotnet/runtime | Build product | Log | dotnet/runtime#95249 |
Summary
24-Hour Hit Count | 7-Day Hit Count | 1-Month Count |
---|---|---|
0 | 1 | 6 |
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 31 (26 by maintainers)
Mutex.Unix.cs
is only used with theWaitSubsystem
implementation, on CoreCLR the Unix implementation (confusingly) usesMutex.Windows.cs
, the p/invoke goes into the PAL, which implements Windows-like APIs such asReleaseMutex
.@am11 I don’t think that would be it since that implementation does not support named mutexes.
I didn’t see anything obvious that would cause a
ReleaseMutex
to fail withApplicationException
. Another reason for throwing that exception is if the handle does not represent a mutex for some reason, though that would be unlikely.Maybe it would be useful to add some more info to the exception message, like maybe:
TryLock
Not sure it would help much but may at least rule something out.
Noticed something else, though it probably wouldn’t lead to this issue. This line should probably catch
AbandonedMutexException
and setIsLocked
to true in that case, instead of catching it in the caller, otherwiseIsLocked
would remain false upon exception and the thread would abandon the mutex again.