-
-
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
Fix finalizer_ref usage of lock/wait resulting in task switches in gc context #41846
Fix finalizer_ref usage of lock/wait resulting in task switches in gc context #41846
Conversation
@vtjnash Thanks for the review! Forgot to cleanup that trylock logic, but I made it nice now. |
@Sacha0 Hey, could this be backported to 1.7? It's a relatively common error occuring in Dagger under any heavier usage. Would be awesome if this could be already fixed on 1.7 when it releases! |
Tagging for backport --- thanks for the note Krystian! :) |
…d task switches (JuliaLang/julia#41846) (cherry picked from commit d060255)
Restructured some code, so that lock on the
client_refs
is obtained once at the beginning of the finalizer.It's obtained using
trylock
instead oflock
down the line in the functions invoked later.Usage of
lock
in gc context led to callingwait()
and a task switch attempt.Catching the error and trying again led to different errors (switching to exited tasks) due to failed task switch handling in
ensure_scheduled
intask.jl
, so I went for repeatedtrylock
instead.Fix addresses the two following issues found in JuliaParallel/Dagger.jl#243
And supersedes #41786