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

[Linux] Prevent GC from running during process teardown #57832

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/signals-unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,10 @@ static void *signal_listener(void *arg)
}
#endif
if (doexit) {
// Let's forbid threads from running GC while we're trying to exit,
// also let's make sure we're not in the middle of GC.
jl_atomic_fetch_add(&jl_gc_disable_counter, 1);
jl_safepoint_wait_gc(NULL);
// The exit can get stuck if it happens at an unfortunate spot in thread 0
// (unavoidable due to its async nature).
// Try much harder to exit next time, if we get multiple exit requests.
Expand Down