Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Deadlock with parallel stop-world/fork calls in MT #15096

Conversation

ysbaddaden
Copy link
Contributor

Trying to stop the world from a thread while threads are forking leads to a deadlock situation in glibc (at least) because we disable the reception of all signals while we fork.

Since the suspend and resume signals are handled directly and not processed through the event loop (for obvious reasons) we can safely keep these signals enabled. Apparently it's even safer 😅

fixes #13698

Trying to stop the world from a thread while threads are forking leads
to a deadlock situation in glibc (at least) because we disable the
reception of *all* signals while we fork.

Since the suspend and resume signals are handled directly and not
processed through the event loop (for obvious reasons) we can safely
keep these signals enabled. Apparently it's even safer.
@ysbaddaden ysbaddaden added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:runtime topic:multithreading platform:unix labels Oct 18, 2024
@straight-shoota straight-shoota added this to the 1.15.0 milestone Oct 18, 2024
@straight-shoota straight-shoota changed the title Fix: deadlock with parallel stop-world/fork calls [MT] Fix Deadlock with parallel stop-world/fork calls in MT Oct 19, 2024
@straight-shoota straight-shoota merged commit 57017f6 into crystal-lang:master Oct 19, 2024
66 checks passed
@ysbaddaden ysbaddaden deleted the fix/deadlock-with-parallel-stop-the-world-and-fork branch October 21, 2024 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. platform:unix topic:multithreading topic:stdlib:runtime
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Signals delivery fails constantly
2 participants