-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ctrl-C broken – repeating Ctrl-C required on Julia 1.8 #46635
Comments
I can confirm I have the same issue on Windows 11 on an Intel processor and Windows Terminal 1.15.2203.0
|
Debian 11 (bullseye), amd64, JupyterLab Terminal: julia> versioninfo()
Julia Version 1.8.0
Commit 5544a0fab76 (2022-08-17 13:38 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 40 × Intel(R) Xeon(R) Silver 4210R CPU @ 2.40GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, cascadelake)
Threads: 1 on 40 virtual cores
Environment:
JULIA_VERSION = 1.8.0
JULIA_PATH = /opt/julia
julia> sleep(123)
^C^C^C^C^C^C^C^C^CWARNING: Force throwing a SIGINT
ERROR: InterruptException:
Stacktrace:
[1] poptask(W::Base.InvasiveLinkedListSynchronized{Task})
@ Base ./task.jl:921
[2] wait()
@ Base ./task.jl:930
[3] wait(c::Base.GenericCondition{Base.Threads.SpinLock})
@ Base ./condition.jl:124
[4] _trywait(t::Timer)
@ Base ./asyncevent.jl:138
[5] wait
@ ./asyncevent.jl:155 [inlined]
[6] sleep(sec::Int64)
@ Base ./asyncevent.jl:240
[7] top-level scope
@ REPL[2]:1
julia> Debian 11 (bullseye), arm64, JupyterLab Terminal: julia> versioninfo()
Julia Version 1.8.0
Commit 5544a0fab76 (2022-08-17 13:38 UTC)
Platform Info:
OS: Linux (aarch64-linux-gnu)
CPU: 8 × unknown
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, generic)
Threads: 1 on 8 virtual cores
Environment:
JULIA_VERSION = 1.8.0
JULIA_PATH = /opt/julia
julia> sleep(123)
^C^C^C^C^C^C^C^C^CWARNING: Force throwing a SIGINT
ERROR: InterruptException:
Stacktrace:
[1] poptask(W::Base.InvasiveLinkedListSynchronized{Task})
@ Base ./task.jl:921
[2] wait()
@ Base ./task.jl:930
[3] wait(c::Base.GenericCondition{Base.Threads.SpinLock})
@ Base ./condition.jl:124
[4] _trywait(t::Timer)
@ Base ./asyncevent.jl:138
[5] wait
@ ./asyncevent.jl:155 [inlined]
[6] sleep(sec::Int64)
@ Base ./asyncevent.jl:240
[7] top-level scope
@ REPL[2]:1
julia> ℹ️ May be reproduced at https://demo.jupyter.b-data.ch or with |
It looks like it is still possible to interrupt Pkg precompilation with a single Ctrl+C (video), strange... |
Narrowing down on the interrupt in Pkg precompilation, I found that while true
sleep(.1)
end Details
This means that Packages that use the "Press Ctrl+C to stop" UI, like an HTTP.jl server, can use this as a workaround. Example with HTTP.jl:Instead of: server = HTTP.serve!(...)
@info "Server running, press Ctrl+C to interrupt..."
wait(server) You can use: server = HTTP.serve!(...)
@info "Server running, press Ctrl+C to interrupt..."
try
while Base.isopen(server)
sleep(.1)
end
catch e
@info "Closing server..."
close(server)
wait(server)
end
|
The more correct way to read ^C in a UI is exemplified here in runtests.jl: Lines 221 to 232 in 276af84
|
I don't think it's reasonable to expect HTTP.jl internals to be messing with REPL/Terminals/raw character input. I also don't really understand what changed though and why doing Ctrl + C doesn't throw an InteruptException like it used to? Maybe we just need to provide an |
@vtnash Besides documenting this use case as a solution to CTRL+C, could |
does a test framework exist for testing keystroke interrupts? |
yes same issue MacOS and Windows |
I don't understand why this is not patched in 1.8.x but put back for 1.9 which is probably months from a release |
Julia 1.9 seems actually close, but I believe there's no solution [PR] yet (though a workaround in Pluto), so I'm afraid it will not make it into 1.9, maybe 1.10, which IS months away. Though if solved likely could be backported to 1.9. I'm guessing the solution isn't too easy (and the behavior that worked, was never promised, so some tradeoff with keeping it, not simply a bug). It's certainly annoying and what I do instead (kills the process on Linux, so not the best workaround for REPL work): |
fixes #46635 Co-authored-by: Jameson Nash <vtjnash@gmail.com>
fixes #46635 co-authored-by: Jameson Nash <vtjnash@gmail.com>
Since Julia 1.8, a single Ctrl-C does not work. I always need to repeat Ctrl-C multiple times to get the forced SIGINT (with
WARNING: Force throwing a SIGINT
):Schermopname.2022-09-05.om.12.21.45.mov
I found this to be the case for anything that I interrupt, not just
sleep
. This means that, to exit Pluto, Jupyter, a web server or any other long running process, users will now need to hold down Ctrl-C, printing multiple WARNINGs, which makes Julia look unstable.Same problem with the MacOS ARM build.
The text was updated successfully, but these errors were encountered: