Skip to content

Conversation

@vchuravy
Copy link
Member

@gbaraldi and I chatted about this during JuliaCon.

Changing the code field of a task after it has been scheduled is wrong.
One could technically change it before it has ever been scheduled,
but I see no good reason to allow that (one can just create the Task to point to the right closure in the first place).

jl_value_t *listt = jl_new_struct(jl_uniontype_type, jl_task_type, jl_nothing_type);
jl_svecset(jl_task_type->types, 0, listt);

const static uint32_t task_constfields[1] = {0x00000040}; // Set fields 7 as constant
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vtjnash should any of the task fields be atomic? I was surprised that things like _state weren't.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most likely yes, correctness would seem to demand that (esp for acquire/release of result after the _state read/write). I think it must have gotten missed in my list of data race issues

@vchuravy
Copy link
Member Author

Okay this is currently failing in serialization.

@vchuravy
Copy link
Member Author

@nanosoldier runtests(ALL, vs = ":master")

@vtjnash
Copy link
Member

vtjnash commented Jul 23, 2024

Didn't you also have another PR that cleared this field once it started running so that we could GC it a bit earlier?

t = Task(()->nothing)
code = deserialize(s)
t = Task(code)
deserialize_cycle(s, t)

This comment was marked as resolved.

@nanosoldier
Copy link
Collaborator

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

@vchuravy
Copy link
Member Author

Didn't you also have another PR that cleared this field once it started running so that we could GC it a bit earlier?

You are thinking about #48037, but that wasn't part of it.

@vchuravy
Copy link
Member Author

�[0K    nested task error: setfield!: const field .code of type Task cannot be changed
�[0K    Stacktrace:
�[0K     [1] setproperty!(x::Task, f::Symbol, v::Nothing)
�[0K       @ Base ./Base.jl:53
�[0K     [2] setproperty!
�[0K       @ ./task.jl:201 [inlined]
�[0K     [3] clear_current_task()
�[0K       @ ConcurrentUtilities ~/.julia/packages/ConcurrentUtilities/QOkoO/src/ConcurrentUtilities.jl:27
�[0K     [4] (::Arrow.var"#102#108"{Bool, Channel{Any}, ConcurrentUtilities.OrderedSynchronizer, Dict{Int64, Arrow.DictEncoding}, Arrow.Batch, Int64})()
�[0K       @ Arrow ~/.julia/packages/ConcurrentUtilities/QOkoO/src/ConcurrentUtilities.jl:49

sigh

@vchuravy
Copy link
Member Author

@vtjnash actually I did have #47829, but Jeff thought this was too breaking. @quinnj than used it in ConcurrentUtils.JuliaServices/ConcurrentUtilities.jl@9a26697

@vchuravy vchuravy requested a review from gbaraldi August 5, 2024 14:45
@gbaraldi
Copy link
Member

gbaraldi commented Aug 5, 2024

LGTM

@ViralBShah
Copy link
Member

Merge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants