Repository navigation
mono_os_mutex_destroy: pthread_mutex_destroy failed #97565
Copy link
Copy link
Closed
Labels
Known Build ErrorUse this to report build issues in the .NET Helix tabUse this to report build issues in the .NET Helix tabarea-Diagnostics-monoblocking-clean-ciBlocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'
Milestone
Description
Build Information
Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=542041
Build error leg or test failing: tracing/runtimeeventsource/nativeruntimeeventsource/nativeruntimeeventsource.cmd
Pull request: #97553
Error Message
Fill the error message using step by step known issues guidance.
{
"ErrorMessage": "mono_os_mutex_destroy: pthread_mutex_destroy failed with \"Resource busy\" (16)",
"ErrorPattern": "",
"BuildRetry": false,
"ExcludeConsoleLog": false
}Known issue validation
Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=542041
Error message validated: mono_os_mutex_destroy: pthread_mutex_destroy failed with "Resource busy" (16)
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 1/26/2024 5:28:29 PM UTC
Report
Summary
| 24-Hour Hit Count | 7-Day Hit Count | 1-Month Count |
|---|---|---|
| 0 | 4 | 13 |
Metadata
Metadata
Assignees
Labels
Known Build ErrorUse this to report build issues in the .NET Helix tabUse this to report build issues in the .NET Helix tabarea-Diagnostics-monoblocking-clean-ciBlocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'
Activity
lambdageek commentedon Jan 26, 2024
Stack trace:
So it's eventpipe cleanup. I think we saw somethign similar recently...
lambdageek commentedon Jan 26, 2024
Might be related to #85960 (comment)
tommcdon commentedon Feb 11, 2024
Possibly addressed with #96936
@davmason
davmason commentedon Feb 13, 2024
The callstack pasted above is not related to #96936, this is crashing in
ep_rt_mono_finiwhich is mono specific cleanup. It's likely a similar issue though, just with a different resource.tommcdon commentedon Feb 26, 2024
@lambdageek would you mind taking a second look and/or provide pointers to @davmason for next steps?
lambdageek commentedon Feb 26, 2024
Next steps are to do less cleanup in
ep_rt_mono_fini. As Johan mentioned in #85960 (comment)I'm not sure what Johan had in mind, but one possiblity is just to call
mono_runtime_is_shutting_downand if it is FALSE, just makeep_rt_mono_finiexit early without cleaning up. But I'm not 100% certain that this will account for all situations where event pipe might be shutting down but managed threads are still running.davmason commentedon Feb 27, 2024
@lambdageek, I spent a little time looking at the mono code and I can't convince myself that
mono_runtime_is_shutting_down ()guarantees that we are not running managed code. Looking atmono_runtime_try_shutdown ()it looks like we just stop creating new threads and don't have any guarantee that current threads are gone. Am I missing something?lambdageek commentedon Feb 27, 2024
@davmason you're probably not missing anything. I don't think we have a way to know when all the existing managed threads are really stopped/gonge (we used to have
mono_thread_suspend_all_other_threadsin "classic" Mono, but in modern .NET we don't try to stop other threads anymore before exiting - it wouldn't work on platforms like WASM, anyway, where we don't have signals).My suggestion was more "best effort" - if we know we haven't started shutting down at all, don't even try to do any cleanup in
ep_rt_mono_fini. If on the other hand shutdown started, we may possibly try to cleanup, but we could still hit the deadlock.pavelsavara commentedon Apr 9, 2024
Probably off-topic here, but we could kill all threads on emscripten via JavaScript, if we are on UI thread. I'm working on it here @lambdageek