-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Description
Define this function in REPL:
julia> function try_interrupt()
while true
try
sleep(1)
println("trying...")
@async 1+1
catch e
if typeof(e) <: InterruptException
println("caught Interrupt")
return
end
end
end
return
end
try_interrupt (generic function with 1 method)In Julia 1.7.2, everything works:
julia> try_interrupt()
trying...
trying...
^Ccaught Interrupt
julia> versioninfo()
Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-6850K CPU @ 3.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, broadwell)But in 1.9.0 it does not work:
julia> versioninfo()
Julia Version 1.9.0-DEV.426
Commit 4dfef57535 (2022-04-21 19:14 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 12 × Intel(R) Core(TM) i7-6850K CPU @ 3.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, broadwell)
Threads: 1 on 12 virtual cores
julia> try_interrupt()
trying...
trying...
^Cfatal: error thrown and no exception handler available.
InterruptException()
jl_mutex_unlock at /home/chunjiw/projects/playground/buildjulia/julia/src/julia_locks.h:129 [inlined]
ijl_task_get_next at /home/chunjiw/projects/playground/buildjulia/julia/src/partr.c:382
poptask at ./task.jl:931
wait at ./task.jl:940
task_done_hook at ./task.jl:640
jfptr_task_done_hook_61719 at /home/chunjiw/projects/playground/buildjulia/julia/usr/lib/julia/sys.so (unknown line)
jl_apply at /home/chunjiw/projects/playground/buildjulia/julia/src/julia.h:1838 [inlined]
jl_finish_task at /home/chunjiw/projects/playground/buildjulia/julia/src/task.c:254
start_task at /home/chunjiw/projects/playground/buildjulia/julia/src/task.c:942In another word, issue #19467 comes back.
If I put the code in a script file.jl, then run it with
julia -i file.jlorjulia -e 'include(popfirst!(ARGS))' file.jl,
then both 1.7.2 and 1.9.0 returns fatal error when attempt to interrupt with Ctrl-C:fatal: error thrown and no exception handler available.
Note: using Base.exit_on_sigint(false) does not solve this issue
Metadata
Metadata
Assignees
Labels
No labels