Work around potential Mono bug, that hangs the runtime when new threads start#1779
Merged
filmor merged 1 commit intopythonnet:masterfrom May 4, 2022
Merged
Conversation
88ecef6 to
64a04d3
Compare
Member
Author
|
:/ it does not fail when the blame mode is on in On my own machine I was able to reproduce it on the first try, but then it never reproduced after that. :/ |
Member
Author
|
Looks like the issue may be with the |
854f20b to
8d9d27e
Compare
8d9d27e to
f730963
Compare
Member
|
This is probably also something that we should include in our docs. |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I suspect the issue is actually with Mono GC and the relatively new mode of suspending threads, which has a few (closed) bugs against it, complaining about hangs. In many of those bugs (you can find them here) switching to the old
preemptivemode works around the issue. I tried it for our tests, and it seems to solve it too.The issue also vaguely mentioned in https://www.mono-project.com/docs/advanced/runtime/docs/coop-suspend/#thread-startfinish-still-bad
So the fix is to simply set
MONO_THREADS_SUSPENDtopreemptivein CI before running tests in Mono.Fixes #1766
This workaround seems to solve the issue on my local machine as well as in CI. I did 5+ CI full matrix reruns to confirm. Before the fix a few MacOS legs would time out in every run.
Below is some history of finding this workaround.