-
-
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
Clean closure and task-local-state in jl_finish_task #47829
Conversation
Can someone get a reference to the fields from julia? Or just to the content? |
As suggested by @vchuravy, and that mirrors the fix proposed in JuliaLang/julia#47829.
If you mean |
* Simpler, better wkspawn implementation As suggested by @vchuravy, and that mirrors the fix proposed in JuliaLang/julia#47829. * Fix nightly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM
Can you also add a test that confirms that objects captured by a Task's closure are GC'd when the Task is finished?
Something like
function foo(x::Vector)
@async length(x)
end
a = []
r = WeakRef(a)
t = foo(a)
a = nothing
wait(t)
GC.gc()
@test r.value === nothing
or somethign like that?
@nanosoldier |
Your package evaluation job has completed - possible new issues were detected. A full report can be found here. |
Two packages observe the nothing AdvancedPS v0.4.3: fail vs. ok |
AdvancedPS uses LibTask, which violates deep assumptions necessary for fast code, and therefore is undefined behavior and unsupported entirely. ChannelBuffers is accessing the fields of a closure via reflection, which is an unstable API–though could be easily re-written to use a stable ABI version by making it a struct instead. I suppose though that this is probably valid code however. |
I think the only non-breaking way to do this is to make tls->current_task like a weak reference, such that when that task is finished and current_task is the only reference, some fields inside the task can be cleared. |
Implements the second part of @vtjnash idea in #47405 (comment)
Particularly motivated by @quinnj observation that it is easy to add a
return nothing
to a task, but the argumentsto the task need to be handled differently. (x-ref #40626 (comment))