julia
julia copied to clipboard
don't throw EOFError from sleep
This prevents sleep from throwing an EOFError under rare conditions (with very short timer durations) where the Timer object is already closed before it can be signaled, which seems like a bug.
why isn't this a correct fix?
It seems like a better fix would make wait(Timer(sec)) safe, somehow.
Timer is an exported API, so ideally calling wait on a newly created Timer should not be a dangerous pattern.
Yes, that is what is wrong about this fix. The wait tries to do some fast paths before locking, but it doesn't implement those correctly, and it doesn't re-check if it is .set after !isopen
https://github.com/JuliaLang/julia/blob/222231f047462bcb2cef3e402c86cf41df82414d/base/asyncevent.jl#L159
Why is there an error throw anyways?
@vtjnash and @stevengj I went through the code a couple of times but don't feel confident to fix this. Can you help me a little to fix it proper
This should fix it https://github.com/JuliaLang/julia/pull/54955
This should be closed because https://github.com/JuliaLang/julia/pull/54955 is merge