Skip to content

Commit ac60df7

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 ff34f4c commit ac60df7

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/cluster.jl

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

197-
T = Threads.@spawn Threads.threadpool() begin
198-
sleep($timeout)
199-
lock(w.c_state) do
200-
notify(w.c_state; all=true)
201-
end
202-
end
203-
errormonitor(T)
204-
lock(w.c_state) do
205-
wait(w.c_state)
206-
w.state === W_CREATED && error("peer $(w.id) didn't connect to $(myid()) within $timeout seconds")
197+
if timedwait(() -> (@atomic w.state) === W_CONNECTED, timeout) === :timed_out
198+
# Notify any waiters on the state and throw
199+
@lock w.c_state notify(w.c_state)
200+
error("peer $(w.id) didn't connect to $(myid()) within $timeout seconds")
207201
end
208202
end
209203
nothing

0 commit comments

Comments
 (0)