(Found and written by Claude)
When using OutputCollector from multiple threads simultaneously, a ConcurrencyViolationError is thrown because notify is called on a Condition without holding the associated lock.
Error:
ConcurrencyViolationError("lock must be held")
Stacktrace:
[1] concurrency_violation()
@ Base ./condition.jl:8
[2] assert_havelock
@ ./condition.jl:25 [inlined]
[3] assert_havelock
@ ./condition.jl:48 [inlined]
[4] assert_havelock
@ ./condition.jl:74 [inlined]
[5] notify(c::Condition, arg::Any, all::Bool, error::Bool)
@ Base ./condition.jl:161
[6] notify (repeats 2 times)
@ ./condition.jl:159 [inlined]
[7] (::OutputCollectors.var"#LineStream##0#LineStream##1"{Pipe, Condition, Vector{Tuple{Float64, String}}})()
@ OutputCollectors ~/.julia/packages/OutputCollectors/c0ZGU/src/OutputCollectors.jl:68
Context:
This was discovered when BinaryBuilder.jl ran sandbox operations in parallel (via Threads.@threads). Each sandbox operation creates its own OutputCollector, but the error suggests there's some shared state or the Condition usage isn't thread-safe.
Looking at line 68 in OutputCollectors.jl, there's a notify(c) call that needs to be wrapped in a lock.
Julia Version: 1.12
(Found and written by Claude)
When using
OutputCollectorfrom multiple threads simultaneously, aConcurrencyViolationErroris thrown becausenotifyis called on aConditionwithout holding the associated lock.Error:
Context:
This was discovered when BinaryBuilder.jl ran sandbox operations in parallel (via
Threads.@threads). Each sandbox operation creates its ownOutputCollector, but the error suggests there's some shared state or theConditionusage isn't thread-safe.Looking at line 68 in
OutputCollectors.jl, there's anotify(c)call that needs to be wrapped in a lock.Julia Version: 1.12