-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[Foreign threads] Install signal-handlers early #49930
Conversation
@JeffBezanson and @vtjnash this Lines 1624 to 1638 in 944b28c
Besides turning GC off in |
Something like:
Maybe? |
Running this as-is results in a failed assertion: Temporarily disabling that call to So both moving the signal handler set-up earlier and changing the default gc_state seem to violate what the existing task set-up code assumes. At the risk of missing something obvious here, can't we do something simpler and have the foreign thread spin until it's actually safe to enter GC unsafe region, i.e., until GC has run? |
That is what a GC-unsafe transition is. |
While true the current implementation is a using the signal handler so we either need to set that up before we first transition a thread or use a slightly different mechanism for first transition. I think we need to more carefully audit what code is run during setup off a foreign thread / replace them with safe alternatives |
Owed in favor to #49934, I think that approach is easier to make sound. |
In #49928 we identified a couple of problems:
jl_init_threadtls
sets thegc_state
to 0, effectivly bypassing thegc_unsafe_enter
transitionjl_init_root_tasks
assumes that GC is turned off and installs the signal-handler very lateThis moves the signal handler installation before the the
gc_unsafe
transition.