Interrupting task in 0.4 used to fail gracefully, while in 0.5+ it freezes the REPL in some situations, e.g:
0.4.7 :
julia> t = @schedule begin
try
remotecall_fetch(1,sleep,100)
catch err
rethrow(err)
end
end
Task (waiting) @0x000000010fb39a50
julia> Base.throwto(t, InterruptException());
ERROR: InterruptException:
in yieldto at /Applications/Julia-0.4.7.app/Contents/Resources/julia/lib/julia/sys.dylib
in wait at /Applications/Julia-0.4.7.app/Contents/Resources/julia/lib/julia/sys.dylib (repeats 2 times)
in sleep at stream.jl:696
in anonymous at multi.jl:700
in run_work_thunk at multi.jl:661
in remotecall_fetch at multi.jl:734
in remotecall_fetch at multi.jl:750
[inlined code] from none:3
in anonymous at task.jl:63
in throwto at task.jl:76
julia>
0.7.0-DEV.26
julia> t = @schedule begin
try
remotecall_fetch(sleep,1,100)
catch err
rethrow(err)
end
end
Task (runnable) @0x00000001132b4010
julia> Base.throwto(t, InterruptException());
ERROR (unhandled task failure): InterruptException:
try_yieldto(::Base.##296#297{Task}, ::Task) at ./event.jl:189
wait() at ./event.jl:234
wait(::Condition) at ./event.jl:27
stream_wait(::Timer, ::Condition, ::Vararg{Condition,N} where N) at ./stream.jl:42
wait(::Timer) at ./event.jl:357
sleep(::Int64) at ./event.jl:411
(::Base.Distributed.##135#136{Base.#sleep,Tuple{Int64},Array{Any,1}})() at ./distributed/remotecall.jl:314
run_work_thunk(::Base.Distributed.##135#136{Base.#sleep,Tuple{Int64},Array{Any,1}}, ::Bool) at ./distributed/process_messages.jl:56
#remotecall_fetch#140(::Array{Any,1}, ::Function, ::Function, ::Base.Distributed.LocalProcess, ::Int64, ::Vararg{Int64,N} where N) at ./distributed/remotecall.jl:339
remotecall_fetch(::Function, ::Base.Distributed.LocalProcess, ::Int64, ::Vararg{Int64,N} where N) at ./distributed/remotecall.jl:339
#remotecall_fetch#144(::Array{Any,1}, ::Function, ::Function, ::Int64, ::Int64, ::Vararg{Int64,N} where N) at ./distributed/remotecall.jl:367
macro expansion at ./REPL[2]:3 [inlined]
(::##3#4)() at ./event.jl:73
Stacktrace:
[1] #remotecall_fetch#140(::Array{Any,1}, ::Function, ::Function, ::Base.Distributed.LocalProcess, ::Int64, ::Vararg{Int64,N} where N) at ./distributed/remotecall.jl:340
[2] remotecall_fetch(::Function, ::Base.Distributed.LocalProcess, ::Int64, ::Vararg{Int64,N} where N) at ./distributed/remotecall.jl:339
[3] #remotecall_fetch#144(::Array{Any,1}, ::Function, ::Function, ::Int64, ::Int64, ::Vararg{Int64,N} where N) at ./distributed/remotecall.jl:367
[4] macro expansion at ./REPL[2]:3 [inlined]
[5] (::##3#4)() at ./event.jl:73
^C
fatal: error thrown and no exception handler available.
InterruptException()
jl_run_once at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/jl_uv.c:132
process_events at ./libuv.jl:82 [inlined]
wait at ./event.jl:216
task_done_hook at ./task.jl:256
jlcall_task_done_hook_21883 at /Applications/Julia-0.7.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia.h:1422 [inlined]
finish_task at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/task.c:232
start_task at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/task.c:275
For context, I’m getting this kind of issues when using Gtk.jl
, in which case interrupting any task makes Gtk crash in 0.5+.
Is this a bug or is there a way to get back 0.4 behaviour (by handling the error or interrupting differently) ?