remotecall_fetch hangs when CPU is busy on the remote host #16874 Closed davidparks21 opened this Issue on Jun 10 · 1 comment Projects None yet Labels parallel Milestone No milestone Assignees No one assigned 3 participants @davidparks21 @amitmurthy @tkelman Notifications You’re not receiving notifications from this thread. @davidparks21 davidparks21 commented on Jun 10 • edited I posted this originally as a forum question, but after reproducing it on multiple machines, I'm confident that it's an issue that needs to be addressed. https://groups.google.com/forum/#!topic/julia-users/pH-CuZlspic remotecall_fetch (and generally remotecall) hangs indefinitely when the remote CPU is busy. The code below demonstrates a simple example that can be run locally to reproduce the issue. addprocs(1) @everywhere module Test stop_flag = false function runner() global stop_flag; while(!stop_flag) x=rand(5000,5000); end end function stopper() global stop_flag; stop_flag = true; end end remotecall(2, Test.runner) remotecall_fetch(2, Test.stopper) # Hangs here indefinitely I've attempted to start the remote process asynchronously, but it doesn't change the results. It seems likely that the remotecall listener does not have a high enough thread priority. Though I haven't actually looked into the mechanics of it myself. julia> versioninfo() Julia Version 0.4.5 Commit 2ac304d (2016-03-18 00:58 UTC) Platform Info: System: Windows (x86_64-w64-mingw32) CPU: Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz WORD_SIZE: 64 BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell) LAPACK: libopenblas64_ LIBM: libopenlibm LLVM: libLLVM-3.3 @tkelman tkelman added the parallel label on Jun 10 @amitmurthy The Julia Language member amitmurthy commented on Jun 12 There is a single thread of execution. Tasks are light-weight coroutines scheduled co-operatively on the single OS thread. There is no pre-emption of running tasks. Tasks yield either on IO or by calling yield() explicitly. If a task does not yield (your example above), no other tasks can execute. Changing function runner() global stop_flag; while(!stop_flag) x=rand(5000,5000); end end to function runner() global stop_flag while(!stop_flag) yield() x=rand(5000,5000) end end will work as intended. @amitmurthy amitmurthy closed this on Jun 12