Skip to content
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 in julia on windows 10 #50325

Closed
fps opened this issue Jun 28, 2023 · 13 comments · Fixed by #51307
Closed

CTRL-C in julia on windows 10 #50325

fps opened this issue Jun 28, 2023 · 13 comments · Fixed by #51307
Labels
system:windows Affects only Windows

Comments

@fps
Copy link

fps commented Jun 28, 2023

Julia crashes quite often when interrupting loops with ctrl-c. This happens to me only in windows, linux is seemingly fine. The simplest NWE being this one:

julia> while true; end
WARNING: Force throwing a SIGINT

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x7ffcd4ea0a65 -- jl_throw_in_ctx at C:/workdir/src\signals-win.c:130
in expression starting at REPL[1]:1
Allocations: 2998 (Pool: 2986; Big: 12); GC: 0

C:\Users\fschmidt\AppData\Local\Programs\Julia-1.9.1\bin>

But it also happens during more elaborate loops with plotting, optimizing a neural network and printing some terminal output. There's a ca. 50/50 chance of julia crashing. Here's one corresponding crash output:

fatal: error thrown and no exception handler available.
InterruptException()
sigatomic_end at .\c.jl:452 [inlined]
task_done_hook at .\task.jl:670
jfptr_task_done_hook_49669.clone_1 at C:\Users\fschmidt\AppData\Local\Programs\Julia-1.9.1\lib\julia\sys.dll (unknown line)
jl_apply at C:/workdir/src\julia.h:1879 [inlined]
jl_finish_task at C:/workdir/src\task.c:320
start_task at C:/workdir/src\task.c:1103

If you need more debugging info, please let me know..

julia> versioninfo()
Julia Version 1.9.1
Commit 147bdf428c (2023-06-07 08:27 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 4 × Intel(R) Core(TM) i5-7600 CPU @ 3.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, skylake)
  Threads: 2 on 4 virtual cores
Environment:
  JULIA_NUM_THREADS = 2
@ViralBShah
Copy link
Member

Does it happen on older releases as well?

@ViralBShah ViralBShah added the system:windows Affects only Windows label Jun 28, 2023
@fps
Copy link
Author

fps commented Jun 28, 2023 via email

@PallHaraldsson
Copy link
Contributor

There was no Julia 0.9, only 0.7/1.0, but I believe CTRL-C worked at some point, better, on some 1.0+, then got worse. My recollection is it started not working, i.e. being ignored, I don't recall a segfault implicated.

@fps
Copy link
Author

fps commented Jun 29, 2023

Here's 0.7 with the minimal example:

julia> while true; end
WARNING: Force throwing a SIGINT

C:\Users\fschmidt\AppData\Local\Julia-0.7.0\bin>

No segfault, but it exits... Here's a little more involved example:

julia> while true; x = randn(10,10); y = x * x; end
ERROR:
Stacktrace:
 [1] Type at .\boot.jl:396 [inlined]
 [2] Type at .\boot.jl:409 [inlined]
 [3] randn(::Random.MersenneTwister, ::Type{Float64}, ::Int64, ::Int64) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v0.7\Random\src\normal.jl:182
 [4] randn at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v0.7\Random\src\normal.jl:188 [inlined]
 [5] top-level scope at .\REPL[1]:1 [inlined]
 [6] top-level scope at .\none:0SYSTEM: show(lasterr) caused an error
InterruptException()

Stacktrace:
 [1] Type at .\boot.jl:396 [inlined]
 [2] Type at .\boot.jl:409 [inlined]
 [3] randn(::Random.MersenneTwister, ::Type{Float64}, ::Int64, ::Int64) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v0.7\Random\src\normal.jl:182
 [4] randn at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v0.7\Random\src\normal.jl:188 [inlined]
 [5] top-level scope at .\REPL[1]:1 [inlined]
 [6] top-level scope at .\none:0
 [7] eval(::Module, ::Any) at .\boot.jl:319
 [8] eval_user_input(::Any, ::REPL.REPLBackend) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v0.7\REPL\src\REPL.jl:85
 [9] macro expansion at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v0.7\REPL\src\REPL.jl:117 [inlined]
 [10] (::getfield(REPL, Symbol("##28#29")){REPL.REPLBackend})() at .\task.jl:262ERROR: InterruptException:
Stacktrace:
 [1] sigatomic_end at .\c.jl:425 [inlined]
 [2] print_response(::IO, ::Any, ::Any, ::Bool, ::Bool, ::Any) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v0.7\REPL\src\REPL.jl:176
 [3] print_response(::REPL.AbstractREPL, ::Any, ::Any, ::Bool, ::Bool) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v0.7\REPL\src\REPL.jl:139
 [4] (::getfield(REPL, Symbol("#do_respond#40")){Bool,getfield(REPL, Symbol("##50#59")){REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v0.7\REPL\src\REPL.jl:708
 [5] #invokelatest#1 at .\essentials.jl:691 [inlined]
 [6] invokelatest at .\essentials.jl:690 [inlined]
 [7] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v0.7\REPL\src\LineEdit.jl:2261
 [8] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v0.7\REPL\src\REPL.jl:1029
 [9] run_repl(::REPL.AbstractREPL, ::Any) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v0.7\REPL\src\REPL.jl:191
 [10] (::getfield(Base, Symbol("##831#833")){Bool,Bool,Bool,Bool})(::Module) at .\logging.jl:311
 [11] #invokelatest#1 at .\essentials.jl:691 [inlined]
 [12] invokelatest at .\essentials.jl:690 [inlined]
 [13] macro expansion at .\logging.jl:308 [inlined]
 [14] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at .\client.jl:340
 [15] exec_options(::Base.JLOptions) at .\client.jl:252
 [16] _start() at .\client.jl:432

C:\Users\fschmidt\AppData\Local\Julia-0.7.0\bin>

Also no segfault, but exits sometimes instead of returning to the prompt. This exiting is somewhat hard to reproduce though. So I suspect a race condition somewhere..

@fps
Copy link
Author

fps commented Jun 29, 2023

1.0.5:

julia> while true; end
WARNING: Force throwing a SIGINT

C:\Users\fschmidt\AppData\Local\Julia-1.0.5\bin>

I couldn't reproduce the second exit here in a couple of tries..

@fps
Copy link
Author

fps commented Jun 29, 2023

1.1.1:

julia> while true; end
WARNING: Force throwing a SIGINT

C:\Users\fschmidt\AppData\Local\Julia-1.1.1\bin>

Same for the second example

@fps
Copy link
Author

fps commented Jun 29, 2023

1.2.0:

julia> while true; end
WARNING: Force throwing a SIGINT

C:\Users\fschmidt\AppData\Local\Julia-1.2.0\bin>

Same for the second example

@fps
Copy link
Author

fps commented Jun 29, 2023

1.3.0:

julia> while true; end
WARNING: Force throwing a SIGINT

C:\Users\fschmidt\AppData\Local\Julia-1.3.0\bin>

Same for the second example

@fps
Copy link
Author

fps commented Jun 29, 2023

1.4.2:

julia> while true; end
WARNING: Force throwing a SIGINT

C:\Users\fschmidt\AppData\Local\Programs\Julia\Julia-1.4.2\bin>

Same for the second example

@fps
Copy link
Author

fps commented Jun 29, 2023

Ok, coming from the other side :)

1.9.0:

julia> while true; end
WARNING: Force throwing a SIGINT

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x7ffa094b09c5 -- jl_throw_in_ctx at C:/workdir/src\signals-win.c:130
in expression starting at REPL[1]:1
Allocations: 2997 (Pool: 2984; Big: 13); GC: 0

@fps
Copy link
Author

fps commented Jun 29, 2023

1.8.5:

julia> while true; end
WARNING: Force throwing a SIGINT

C:\Users\fschmidt\AppData\Local\Programs\Julia-1.8.5\bin>

So the segfault was introduced somewhere between 1.8.5 and 1.9.0

@fps
Copy link
Author

fps commented Jun 29, 2023

1.9.0-rc1 has it, too:

julia> while true; end
WARNING: Force throwing a SIGINT

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x7ffa094beca5 -- jl_throw_in_ctx at C:/workdir/src\signals-win.c:130
in expression starting at REPL[1]:1
Allocations: 2995 (Pool: 2984; Big: 11); GC: 0

C:\Users\fschmidt\AppData\Local\Programs\Julia-1.9.0-rc1\bin>

@ViralBShah
Copy link
Member

Related: #49541

vtjnash added a commit that referenced this issue Sep 13, 2023
This was getting current-task on the wrong thread, which resulted in the
value being NULL and crashing.

Fixes #50325
vtjnash added a commit that referenced this issue Sep 13, 2023
This was getting current-task on the wrong thread, which resulted in the
value being NULL and crashing.

Fixes #50325
vtjnash added a commit that referenced this issue Sep 14, 2023
This was getting current-task on the wrong thread, which resulted in the
value being NULL and crashing.

Fixes #50325
KristofferC pushed a commit that referenced this issue Sep 15, 2023
This was getting current-task on the wrong thread, which resulted in the
value being NULL and crashing.

Fixes #50325

(cherry picked from commit 5090bc0)
NHDaly pushed a commit that referenced this issue Sep 20, 2023
This was getting current-task on the wrong thread, which resulted in the
value being NULL and crashing.

Fixes #50325
nalimilan pushed a commit that referenced this issue Nov 5, 2023
This was getting current-task on the wrong thread, which resulted in the
value being NULL and crashing.

Fixes #50325

(cherry picked from commit 5090bc0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
system:windows Affects only Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants