julia icon indicating copy to clipboard operation
julia copied to clipboard

Julia 1.12.0-beta4 crash on Oxygen serve & CTRL+C

Open denglerchr opened this issue 6 months ago • 3 comments

This is working on Julia 1.11, therefore I assume there is an issue in Julia (tested on Windows). Im using Juliaup to install Julia. The bug report includes usage of Oxygen (1.7.1), I posting here though as the bug only happens on Julia 1.12 .

First about my machine

julia> versioninfo()
Julia Version 1.12.0-beta4
Commit 600ac61d3d (2025-06-05 07:03 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 16 × 11th Gen Intel(R) Core(TM) i9-11900H @ 2.50GHz
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, tigerlake)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 16 virtual cores)

Minimal example:

julia> using Oxygen
julia> serve()

Then hit CTRL+C .

On Julia 1.12 this crashed the REPL with this error message.

julia> Unhandled Task ERROR: TaskFailedException
Stacktrace:
 [1] #wait#583
   @ .\task.jl:363 [inlined]
 [2] wait
   @ .\task.jl:360 [inlined]
 [3] fetch
   @ .\task.jl:525 [inlined]
 [4] prompt!(term::REPL.Terminals.TextTerminal, prompt::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
   @ REPL.LineEdit C:\Users\dengl\.julia\juliaup\julia-1.12.0-beta4+0.x64.w64.mingw32\share\julia\stdlib\v1.12\REPL\src\LineEdit.jl:2983
 [5] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
   @ REPL.LineEdit C:\Users\dengl\.julia\juliaup\julia-1.12.0-beta4+0.x64.w64.mingw32\share\julia\stdlib\v1.12\REPL\src\LineEdit.jl:2849
 [6] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
   @ REPL C:\Users\dengl\.julia\juliaup\julia-1.12.0-beta4+0.x64.w64.mingw32\share\julia\stdlib\v1.12\REPL\src\REPL.jl:1664
 [7] (::REPL.var"#61#62"{REPL.LineEditREPL, REPL.REPLBackendRef})()
   @ REPL C:\Users\dengl\.julia\juliaup\julia-1.12.0-beta4+0.x64.w64.mingw32\share\julia\stdlib\v1.12\REPL\src\REPL.jl:651

    nested task error: InterruptException:
    Stacktrace:
     [1] yieldto(t::Task, x::Any)
       @ Base .\task.jl:1101
     [2] yieldto
       @ .\task.jl:1095 [inlined]
     [3] wait()
       @ Base .\task.jl:1213
     [4] wait(c::Base.GenericCondition{Base.Threads.SpinLock}; first::Bool)
       @ Base .\condition.jl:141
     [5] wait
       @ .\condition.jl:136 [inlined]
     [6] wait_readnb(x::Base.TTY, nb::Int64)
       @ Base .\stream.jl:416
     [7] eof(s::Base.TTY)
       @ Base .\stream.jl:106
     [8] eof(io::REPL.Terminals.TTYTerminal)
       @ Base .\io.jl:472
     [9] (::REPL.LineEdit.var"#prompt!##2#prompt!##3"{REPL.Terminals.TTYTerminal, REPL.LineEdit.ModalInterface, REPL.LineEdit.MIState, REPL.LineEdit.Prompt})()
       @ REPL.LineEdit C:\Users\dengl\.julia\juliaup\julia-1.12.0-beta4+0.x64.w64.mingw32\share\julia\stdlib\v1.12\REPL\src\LineEdit.jl:2948
ERROR: TaskFailedException
Stacktrace:
  [1] try_yieldto(undo::typeof(Base.ensure_rescheduled))
    @ Base .\task.jl:1128
  [2] wait()
    @ Base .\task.jl:1225
  [3] wait(c::Base.GenericCondition{ReentrantLock}; first::Bool)
    @ Base .\condition.jl:141
  [4] wait
    @ .\condition.jl:136 [inlined]
  [5] take_buffered(c::Channel{Any})
    @ Base .\channels.jl:532
  [6] take!
    @ .\channels.jl:526 [inlined]
  [7] repl_backend_loop(backend::REPL.REPLBackend, get_module::Function)
    @ REPL C:\Users\dengl\.julia\juliaup\julia-1.12.0-beta4+0.x64.w64.mingw32\share\julia\stdlib\v1.12\REPL\src\REPL.jl:438
  [8] start_repl_backend(backend::REPL.REPLBackend, consumer::Any; get_module::Function)
    @ REPL C:\Users\dengl\.julia\juliaup\julia-1.12.0-beta4+0.x64.w64.mingw32\share\julia\stdlib\v1.12\REPL\src\REPL.jl:428
  [9] start_repl_backend
    @ C:\Users\dengl\.julia\juliaup\julia-1.12.0-beta4+0.x64.w64.mingw32\share\julia\stdlib\v1.12\REPL\src\REPL.jl:425 [inlined]
 [10] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool, backend::Any)
    @ REPL C:\Users\dengl\.julia\juliaup\julia-1.12.0-beta4+0.x64.w64.mingw32\share\julia\stdlib\v1.12\REPL\src\REPL.jl:654
 [11] run_repl(repl::REPL.AbstractREPL, consumer::Any)
    @ REPL C:\Users\dengl\.julia\juliaup\julia-1.12.0-beta4+0.x64.w64.mingw32\share\julia\stdlib\v1.12\REPL\src\REPL.jl:640
 [12] run_std_repl(REPL::Module, quiet::Bool, banner::Symbol, history_file::Bool)
    @ Base .\client.jl:482
 [13] run_main_repl(interactive::Bool, quiet::Bool, banner::Symbol, history_file::Bool)
    @ Base .\client.jl:503
 [14] repl_main
    @ .\client.jl:590 [inlined]
 [15] _start()
    @ Base .\client.jl:565

    nested task error: TaskFailedException
    Stacktrace:
     [1] #wait#583
       @ .\task.jl:363 [inlined]
     [2] wait
       @ .\task.jl:360 [inlined]
     [3] fetch
       @ .\task.jl:525 [inlined]
     [4] prompt!(term::REPL.Terminals.TextTerminal, prompt::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
       @ REPL.LineEdit C:\Users\dengl\.julia\juliaup\julia-1.12.0-beta4+0.x64.w64.mingw32\share\julia\stdlib\v1.12\REPL\src\LineEdit.jl:2983
     [5] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
       @ REPL.LineEdit C:\Users\dengl\.julia\juliaup\julia-1.12.0-beta4+0.x64.w64.mingw32\share\julia\stdlib\v1.12\REPL\src\LineEdit.jl:2849
     [6] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
       @ REPL C:\Users\dengl\.julia\juliaup\julia-1.12.0-beta4+0.x64.w64.mingw32\share\julia\stdlib\v1.12\REPL\src\REPL.jl:1664
     [7] (::REPL.var"#61#62"{REPL.LineEditREPL, REPL.REPLBackendRef})()
       @ REPL C:\Users\dengl\.julia\juliaup\julia-1.12.0-beta4+0.x64.w64.mingw32\share\julia\stdlib\v1.12\REPL\src\REPL.jl:651

        nested task error: InterruptException:
        Stacktrace:
         [1] yieldto(t::Task, x::Any)
           @ Base .\task.jl:1101
         [2] yieldto
           @ .\task.jl:1095 [inlined]
         [3] wait()
           @ Base .\task.jl:1213
         [4] wait(c::Base.GenericCondition{Base.Threads.SpinLock}; first::Bool)
           @ Base .\condition.jl:141
         [5] wait
           @ .\condition.jl:136 [inlined]
         [6] wait_readnb(x::Base.TTY, nb::Int64)
           @ Base .\stream.jl:416
         [7] eof(s::Base.TTY)
           @ Base .\stream.jl:106
         [8] eof(io::REPL.Terminals.TTYTerminal)
           @ Base .\io.jl:472
         [9] (::REPL.LineEdit.var"#prompt!##2#prompt!##3"{REPL.Terminals.TTYTerminal, REPL.LineEdit.ModalInterface, REPL.LineEdit.MIState, REPL.LineEdit.Prompt})()
           @ REPL.LineEdit C:\Users\dengl\.julia\juliaup\julia-1.12.0-beta4+0.x64.w64.mingw32\share\julia\stdlib\v1.12\REPL\src\LineEdit.jl:2948

denglerchr avatar Jun 10 '25 11:06 denglerchr

That's unfortunately not weird. You sent an asynchronous exception to your program, which can and did cause the scheduler to get in a bad state. So not much that can be done. Not sure if we want to close this but there's around 15 other issues that observe this so I'll take this off the milestone. If someone wants to bisect this then maybe we can change this slightly

gbaraldi avatar Jun 13 '25 14:06 gbaraldi

This was not an issue in previous Julia versions, why do you believe there is not much that can be done? I assume this is a bug and it needs fixing?

denglerchr avatar Jun 13 '25 14:06 denglerchr

This is a bug and should be fixed. But it's not release blocking. It's one of several issues with ctrl-c handling (just search for ctrl-c in the issue tracker). The fact that this used to work and doesn't doesn't mean that there wasn't an underlying bug before that's still there and is now exposed differently

gbaraldi avatar Jun 13 '25 15:06 gbaraldi

This is caused by https://github.com/JuliaLang/julia/pull/57544#issuecomment-2978227885 which is new in 1.12. This change basically makes 1.12 guaranteed to get corrupted by ^C, whereas before there was at least a chance this worked. I think this is bad enough that it needs to be on the milestone.

Keno avatar Jun 16 '25 21:06 Keno

Do we not properly try/catch/restart that task?

vtjnash avatar Jun 16 '25 23:06 vtjnash

We don't, but even if we did that, that would just result in us swallowing all InterruptExceptions.

Keno avatar Jun 16 '25 23:06 Keno

IJulia is also affected by this, on 1.12 notebook() and jupyterlab() will completely crash Julia when hitting Ctrl + C to stop the notebook server. Relevant code is here: https://github.com/JuliaLang/IJulia.jl/blob/b4d91ee86972601c2082f0d5a14830000cf8c5f1/src/jupyter.jl#L61

JamesWrigley avatar Jun 17 '25 07:06 JamesWrigley

@denglerchr and/or @JamesWrigley: could I ask you to try out this fix and let us know if it returns the old behavior?

kpamnany avatar Jun 17 '25 20:06 kpamnany

Yep, I ran notebook() a few times and it seems to work:

julia> versioninfo()
Julia Version 1.13.0-DEV.751
Commit b4e747c5396* (2025-06-17 18:54 UTC)
Platform Info:
  OS: Linux (x86_64-redhat-linux)
  CPU: 12 × Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz
  WORD_SIZE: 64
  LLVM: libLLVM-20.1.2 (ORCJIT, skylake)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 12 virtual cores)
Environment:
  LD_LIBRARY_PATH = :/opt/zfp/lib64:/opt/adios2/lib:/usr/lib64/openmpi/lib:/usr/local/lib
  JULIA_EDITOR = vim

JamesWrigley avatar Jun 17 '25 21:06 JamesWrigley

Hello, Im not sure how to test this tbh. Can I just take nightly Julia or do I need to build it or...? Sorry, Im not that deep into it I guess.

denglerchr avatar Jun 18 '25 09:06 denglerchr

Typically you can download the built binary from CI with juliaup add pr58765, but the build failed for that PR for my platform so I ended up checking out the kp-reduce-sched-task branch from git and building it locally.

JamesWrigley avatar Jun 18 '25 09:06 JamesWrigley

Just adding my comment that this is very serious in my opinion.

Ctrl-C to interrupt an infinite loop in the REPL crashes Julia 1.12.

MWE session
$ julia +1.12
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.12.0-beta4 (2025-06-05)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org release
|__/                   |

julia> versioninfo()
Julia Version 1.12.0-beta4
Commit 600ac61d3d2 (2025-06-05 07:03 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 8 × Apple M2
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, apple-m2)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 4 virtual cores)
Environment:
  JULIA_EDITOR = subl
  JULIA_SHELL = zsh

julia> function a()
           while true
               sleep(0.02)
           end
       end
a (generic function with 1 method)

julia> a()
^CERROR: InterruptException:
Stacktrace:
  [1] try_yieldto(undo::typeof(identity))
atal: error thrown and no exception handler available.
InterruptException()k, x::Any)
yieldto at ./task.jl:1101
yieldto at ./task.jl:1095 [inlined]
wait at ./task.jl:1213inlined]
uv_write at ./stream.jl:1080
unsafe_write at ./stream.jl:1153
write at ./strings/io.jl:246 [inlined]se.Threads.SpinLock}; first::Bool)
print at ./strings/io.jl:248 [inlined]
#with_output_color#849 at ./util.jl:112
with_output_color at ./util.jl:73 [inlined]
#printstyled#850 at ./util.jl:141 [inlined]
printstyled at ./util.jl:141 [inlined]
display_error at ./client.jl:109
unknown function (ip: 0x111dd8337) at (unknown file)
display_error at ./client.jl:113
unknown function (ip: 0x111dc010f) at (unknown file)
jl_apply at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-12/src/./julia.h:2369 [inlined]
jl_f_invokelatest at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-12/src/builtins.c:854
_start at ./client.jl:571
jfptr__start_59543.1 at /Users/josephwilson/.julia/juliaup/julia-1.12.0-beta4+0.aarch64.apple.darwin14/lib/julia/sys.dylib (unknown line)
jl_apply at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-12/src/./julia.h:2369 [inlined]
true_main at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-12/src/jlapi.c:959
jl_repl_entrypoint at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-12/src/jlapi.c:1126
39m ./task.jl:1095 [inlined]
     [3] wait()rm::REPL.Terminals.TextTerminal, prompt::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
       @ Base ./task.jl:1213juliaup/julia-1.12.0-beta4+0.aarch64.apple.darwin14/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2983
     [4] wait(c::Base.GenericCondition{Base.Threads.SpinLock}; first::Bool)ModalInterface, s::REPL.LineEdit.MIState)
       @ Base ./condition.jl:141aup/julia-1.12.0-beta4+0.aarch64.apple.darwin14/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2849
     [5] waittend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
       @ ./condition.jl:136 [inlined].0-beta4+0.aarch64.apple.darwin14/share/julia/stdlib/v1.12/REPL/src/REPL.jl:1664
     [6] wait_readnb(x::Base.TTY, nb::Int64)REPL.REPLBackendRef})()
       @ Base ./stream.jl:416lia-1.12.0-beta4+0.aarch64.apple.darwin14/share/julia/stdlib/v1.12/REPL/src/REPL.jl:651
     [7] eof(s::Base.TTY)
       @ Base ./stream.jl:106uptException:
     [8] eof(io::REPL.Terminals.TTYTerminal)
       @ Base ./io.jl:472 x::Any)
     [9] (::REPL.LineEdit.var"#prompt!##2#prompt!##3"{REPL.Terminals.TTYTerminal, REPL.LineEdit.ModalInterface, REPL.LineEdit.MIState, REPL.LineEdit.Prompt})()
       @ REPL.LineEdit ~/.julia/juliaup/julia-1.12.0-beta4+0.aarch64.apple.darwin14/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2948
ERROR:

$ (back to shell)

Jollywatt avatar Jul 01 '25 16:07 Jollywatt

Reverted on 1.12 so moving milestone

KristofferC avatar Jul 03 '25 19:07 KristofferC

Cant even segfault Julia anymore:

julia> 1^CInternal Task ERROR: InterruptException:
Stacktrace:
 [1] wait()
   @ Base ./task.jl:1217
 [2] wait_forever()
   @ Base ./task.jl:1139
^CInternal Task ERROR: InterruptException:
Stacktrace:
 [1] wait()
   @ Base ./task.jl:1217
 [2] wait_forever()
   @ Base ./task.jl:1139
^CInternal Task ERROR: InterruptException:
Stacktrace:
 [1] wait()
   @ Base ./task.jl:1217
 [2] wait_forever()
   @ Base ./task.jl:1139
^CInternal Task ERROR: InterruptException:
Stacktrace:
 [1] wait()
   @ Base ./task.jl:1217
 [2] wait_forever()
   @ Base ./task.jl:1139
^CInternal Task ERROR: InterruptException:

KristofferC avatar Oct 17 '25 17:10 KristofferC

Happens all the time

     Testing Running tests...




^CInternal Task ERROR: InterruptException:
Stacktrace:
 [1] wait()
   @ Base ./task.jl:1217
 [2] wait_forever()
   @ Base ./task.jl:1139
Internal Task ERROR: InterruptException:
Stacktrace:
 [1] wait()
   @ Base ./task.jl:1217
 [2] wait_forever()
   @ Base ./task.jl:1139
^CInternal Task ERROR: InterruptException:
Stacktrace:
 [1] wait()
   @ Base ./task.jl:1217
 [2] wait_forever()
   @ Base ./task.jl:1139
Unhandled Task ERROR: InterruptException:
Stacktrace:
 [1] curl_multi_socket_action
   @ ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/Downloads/src/Curl/Curl.jl:51 [inlined]
 [2] curl_multi_socket_action
   @ ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/Downloads/src/Curl/Curl.jl:59 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/Downloads/src/Curl/utils.jl:51 [inlined]
 [4] (::Downloads.Curl.var"#socket_callback##8#socket_callback##9"{UInt8, Int32, FileWatching.FDWatcher, Downloads.Curl.Multi})()
   @ Downloads.Curl ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/Downloads/src/Curl/Multi.jl:200
 [5] lock(f::Downloads.Curl.var"#socket_callback##8#socket_callback##9"{UInt8, Int32, FileWatching.FDWatcher, Downloads.Curl.Multi}, l::ReentrantLock)
   @ Base ./lock.jl:335
 [6] (::Downloads.Curl.var"#socket_callback##6#socket_callback##7"{Int32, FileWatching.FDWatcher, Downloads.Curl.Multi})()
   @ Downloads.Curl ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/Downloads/src/Curl/Multi.jl:198
^CInternal Task ERROR: InterruptException:
Stacktrace:
 [1] wait()
   @ Base ./task.jl:1217
 [2] wait_forever()
   @ Base ./task.jl:1139
Internal Task ERROR: InterruptException:
Stacktrace:
 [1] wait()
   @ Base ./task.jl:1217
 [2] wait_forever()
   @ Base ./task.jl:1139

KristofferC avatar Oct 19 '25 08:10 KristofferC