I launched a julia REPL and typed x
~ julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: https://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.7.0-DEV.2675 (2017-11-27 20:28 UTC)
_/ |\__'_|_|_|\__'_| | Commit f383276c5b* (4 days old master)
|__/ | x86_64-apple-darwin14.5.0
julia> x
^CInternal error: encountered unexpected error in runtime:
InterruptException()
jl_mutex_unlock at /Users/osx/buildbot/slave/package_osx64/build/src/./locks.h:131 [inlined]
jl_typeinf_end at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:2437
typeinf_code at ./inference.jl:3238
jlcall_typeinf_code_1061 at /Applications/Julia-0.7.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
typeinf_ext at ./inference.jl:3276
jlcall_typeinf_ext_0 at /Applications/Julia-0.7.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
jl_apply at /Users/osx/buildbot/slave/package_osx64/build/src/./julia.h:1475 [inlined]
jl_apply_with_saved_exception_state at /Users/osx/buildbot/slave/package_osx64/build/src/rtutils.c:252
jl_type_infer at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:263
jl_compile_for_dispatch at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1704
jl_compile_method_internal at /Users/osx/buildbot/slave/package_osx64/build/src/./julia_internal.h:348 [inlined]
jl_call_method_internal at /Users/osx/buildbot/slave/package_osx64/build/src/./julia_internal.h:395 [inlined]
jl_apply_generic at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:2010
display_error at ./client.jl:148
inner at ./essentials.jl:669
jl_apply at /Users/osx/buildbot/slave/package_osx64/build/src/./julia.h:1475 [inlined]
jl_f__apply at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:556
jl_f__apply_latest at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:594
print_response at ./repl/REPL.jl:140
unknown function (ip: 0x117d8244a)
print_response at ./repl/REPL.jl:132
unknown function (ip: 0x117d8211a)
do_respond at ./repl/REPL.jl:674
unknown function (ip: 0x117d8055e)
do_call at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:323
eval_body at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:505
jl_interpret_toplevel_thunk_callback at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:720
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x11359b54f)
unknown function (ip: 0xffffffffffffffff)
jl_interpret_toplevel_thunk at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:729
jl_toplevel_eval_flex at /Users/osx/buildbot/slave/package_osx64/build/src/toplevel.c:723
jl_toplevel_eval_in at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:626
eval at ./repl/LineEdit.jl:3
run_interface at ./repl/LineEdit.jl:2159
run_frontend at ./repl/REPL.jl:988
run_repl at ./repl/REPL.jl:182
_start at ./client.jl:453
true_main at /usr/local/bin/julia (unknown line)
main at /usr/local/bin/julia (unknown line)
ERROR: UndefVarError: x not defined
I can reproduce it even without the x by pressing ^C at the right time after launching Julia but before it shows the REPL prompt. Just got this other error:
~ julia
^Cfatal: error thrown and no exception handler available.
InterruptException()
jl_mutex_unlock at /Users/osx/buildbot/slave/package_osx64/build/src/./locks.h:131 [inlined]
jl_generate_fptr at /Users/osx/buildbot/slave/package_osx64/build/src/codegen.cpp:1407
jl_compile_method_internal at /Users/osx/buildbot/slave/package_osx64/build/src/./julia_internal.h:367 [inlined]
jl_call_method_internal at /Users/osx/buildbot/slave/package_osx64/build/src/./julia_internal.h:395 [inlined]
jl_apply_generic at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:2010
true_main at /usr/local/bin/julia (unknown line)
main at /usr/local/bin/julia (unknown line)
I guess, there's are a bunch of startup things happening. I don't think this is a big issue though, just don't press ^C just when starting the REPL?
We could always set an ignore interrupt handler until the REPL is able to handle the interrupt...
This happens at more than just REPL startup:
$ julia
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: https://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.7.0-DEV.3096 (2017-12-19 07:24 UTC)
_/ |\__'_|_|_|\__'_| | Commit 3216445381* (19 days old master)
|__/ | x86_64-apple-darwin14.5.0
julia> 1+1
2
julia> x
^CInternal error: encountered unexpected error in runtime:
InterruptException()
jl_mutex_unlock at /Users/osx/buildbot/slave/package_osx64/build/src/./locks.h:131 [inlined]
jl_typeinf_end at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:2438
typeinf_code at ./inference.jl:3406
jlcall_typeinf_code_1093 at /Applications/Julia-0.7.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
typeinf_ext at ./inference.jl:3447
jlcall_typeinf_ext_0 at /Applications/Julia-0.7.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
[... more stuff ...]
jl_interpret_toplevel_thunk at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:729
jl_toplevel_eval_flex at /Users/osx/buildbot/slave/package_osx64/build/src/toplevel.c:721
jl_toplevel_eval_in at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:626
eval at ./boot.jl:289 [inlined]
eval at ./repl/LineEdit.jl:3
run_interface at ./repl/LineEdit.jl:2228
run_frontend at ./repl/REPL.jl:1024
run_repl at ./repl/REPL.jl:183
_start at ./client.jl:420
true_main at /usr/local/bin/julia (unknown line)
main at /usr/local/bin/julia (unknown line)
ERROR: UndefVarError: x not defined
There are a number of circumstances where the system is vulnerable to internal errors due to valid user input.
The specific errors can vary, but the general theme in this issue is that pressing Ctrl+C at an inopportune time causes Julia to freak out.
This feels to me like the sort of thing that beginning users are apt to run into, so I'd suggest that this issue should probably not be closed. It is not the top priority right now, but in general I'd say this is a legitimate bug.
julia> 1+1
2
julia> x
^CInternal error: encountered unexpected error in runtime:
Yeah, that should indeed not happen.
I can get it to error in type inference but for me, it doesn't crash
julia> x
^CERROR: InterruptException:
Stacktrace:
[1] typeinf_code(::Core.MethodInstance, ::Bool, ::Bool, ::Core.Inference.InferenceParams) at ./inference.jl:2584
[2] typeinf_ext(::Core.MethodInstance, ::UInt64) at ./inference.jl:2622
[3] send_to_backend at ./REPL.jl:624 [inlined]
[4] send_to_backend at ./REPL.jl:622 [inlined]
[5] (::Base.REPL.#do_respond#16{Bool,Base.REPL.##26#36{Base.REPL.LineEditREPL,Base.REPL.REPLHistoryProvider},Base.REPL.LineEditREPL,Base.LineEdit.Prompt})(::Base.LineEdit.MIState, ::Base.AbstractIOBuffer{Array{UInt8,1}}, ::Bool) at ./REPL.jl:640
julia> x
^CSYSTEM: show(lasterr) caused an error
InterruptException()
Stacktrace:
[1] eval(::Module, ::Any) at ./boot.jl:235
[2] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:66
[3] macro expansion at ./REPL.jl:97 [inlined]
[4] (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:73
On 1.3.1 I now see
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.3.1 (2019-12-30)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> x
ERROR: ^C
SYSTEM (REPL): showing an error caused an error
ERROR: InterruptException:
Stacktrace:
[1] lookup(::Ptr{Nothing}) at ./stacktraces.jl:108
[2] ip_matches_func at ./client.jl:75 [inlined]
[3] #761 at ./client.jl:87 [inlined]
[4] findprev(::Base.var"#761#762", ::Array{Union{Ptr{Nothing}, Base.InterpreterIP},1}, ::Int64) at ./array.jl:1893
[5] findlast at ./array.jl:1941 [inlined]
[6] scrub_repl_backtrace(::Array{Union{Ptr{Nothing}, Base.InterpreterIP},1}) at ./client.jl:87
[7] display_error(::IOContext{REPL.Terminals.TTYTerminal}, ::Array{Any,1}) at ./client.jl:102
[8] #invokelatest#1 at ./essentials.jl:709 [inlined]
[9] invokelatest at ./essentials.jl:708 [inlined]
[10] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:151
[11] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:141
[12] (::REPL.var"#do_respond#38"{Bool,REPL.var"#48#57"{REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:719
[13] #invokelatest#1 at ./essentials.jl:709 [inlined]
[14] invokelatest at ./essentials.jl:708 [inlined]
[15] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/REPL/src/LineEdit.jl:2306
[16] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:1045
[17] run_repl(::REPL.AbstractREPL, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:201
[18] (::Base.var"#770#772"{Bool,Bool,Bool,Bool})(::Module) at ./client.jl:382
[19] #invokelatest#1 at ./essentials.jl:709 [inlined]
[20] invokelatest at ./essentials.jl:708 [inlined]
[21] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:366
[22] exec_options(::Base.JLOptions) at ./client.jl:304
[23] _start() at ./client.jl:460
julia> x
ERROR: UndefVarError: x not defined
with a well-timed ^C right after evaluating x for the first time.
It seems like correct behavior to me? When the REPL tried to evaluate x it threw an error because it didn't exist. Then you cancelled the part where it was trying to show an error so it said that showing the error failed and then it showed the stacktrace. What did you expect to happen?
I think that's a fair analysis. Seems like this can be closed as functioning as expected?
That's a good point.
I was imagining encountering this as a beginner and in that case it feels like you're seeing some deep internal state dump inside this stack trace (it contains a lot of unfamiliar terminology), but I think the actual behavior here is fair, and the general sentiment applies more broadly due to the fact that so much of Julia is written in itself.
I could imagine a mode where "internal" data is de-emphasized or hidden, but that's not what this issue is about. Thanks @KristofferC and @StefanKarpinski; feel free to close.