From 2e4481855cdc8a8c18631a9a5c2b4064bc9ab406 Mon Sep 17 00:00:00 2001 From: Chris Foster Date: Sun, 3 Oct 2021 13:13:34 +1000 Subject: [PATCH] Fix world age issue with custom streams for Distributed workers If connect(::CustomClusterManager, ...) returns a custom transport stream, use of that stream by the task in start_gc_msgs_task() may fail due to the task executing in an old world age. Add an invokelatest() to prevent this problem. --- stdlib/Distributed/src/remotecall.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stdlib/Distributed/src/remotecall.jl b/stdlib/Distributed/src/remotecall.jl index 75caf7f3065b7..fca54c7dde22c 100644 --- a/stdlib/Distributed/src/remotecall.jl +++ b/stdlib/Distributed/src/remotecall.jl @@ -270,7 +270,10 @@ function start_gc_msgs_task() # this might miss events wait(any_gc_flag) end - flush_gc_msgs() # handles throws internally + # Use invokelatest() so that custom message transport streams + # for workers can be defined in a newer world age than the Task + # which runs the loop here. + invokelatest(flush_gc_msgs) # handles throws internally end end )