Skip to content

Commit 9d9cf14

Browse files
committed
Replace a timeout task with timedwait()
This should fix an exception seen in CI from the lingering timeout task: ``` Test Summary: | Pass Total Time Deserialization error recovery and include() | 11 11 3.9s From worker 4: Unhandled Task ERROR: EOFError: read end of file From worker 4: Stacktrace: From worker 4: [1] wait From worker 4: @ .\asyncevent.jl:159 [inlined] From worker 4: [2] sleep(sec::Float64) From worker 4: @ Base .\asyncevent.jl:265 From worker 4: [3] (::DistributedNext.var"#34#37"{DistributedNext.Worker, Float64})() From worker 4: @ DistributedNext D:\a\DistributedNext.jl\DistributedNext.jl\src\cluster.jl:213 ```
1 parent 95a9415 commit 9d9cf14

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

src/cluster.jl

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -217,16 +217,10 @@ function wait_for_conn(w)
217217
timeout = worker_timeout() - (time() - w.ct_time)
218218
timeout <= 0 && error("peer $(w.id) has not connected to $(myid())")
219219

220-
T = Threads.@spawn begin
221-
sleep($timeout)
222-
lock(w.c_state) do
223-
notify(w.c_state; all=true)
224-
end
225-
end
226-
errormonitor(T)
227-
lock(w.c_state) do
228-
wait(w.c_state)
229-
(@atomic w.state) === WorkerState_created && error("peer $(w.id) didn't connect to $(myid()) within $timeout seconds")
220+
if timedwait(() -> (@atomic w.state) === WorkerState_connected, timeout) === :timed_out
221+
# Notify any waiters on the state and throw
222+
@lock w.c_state notify(w.c_state)
223+
error("peer $(w.id) didn't connect to $(myid()) within $timeout seconds")
230224
end
231225
end
232226
nothing

0 commit comments

Comments
 (0)