julia icon indicating copy to clipboard operation
julia copied to clipboard

Julia REPL hangs on startup on in GitBash on Windows

Open BenjaminRemez opened this issue 6 months ago • 4 comments

Starting Julia in GitBash on a fresh Git installation on Windows prints the splash screen, and then hangs at the first prompt. (Running Julia in the standard Windows Terminal works fine.) Ctrl-C interrupting Julia prints the stack trace given at the bottom. I am able to use a noninteractive invocation like this:

$ julia --startup-file=no -E "using InteractiveUtils; versioninfo();"
Julia Version 1.11.5
Commit 760b2e5b73 (2025-04-14 06:53 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 8 × Intel(R) Core(TM) Ultra 7 258V
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, goldmont)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
nothing

Stack trace:

$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.11.5 (2025-04-14)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> Unhandled Task ERROR: TaskFailedException # After several minutes of non-responsiveness, here I Ctrl-C'd
Stacktrace:
 [1] wait(t::Task)
   @ Base .\task.jl:370
 [2] fetch
   @ .\task.jl:390 [inlined]
 [3] prompt!(term::REPL.Terminals.TextTerminal, prompt::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
   @ REPL.LineEdit C:\Users\breme\.julia\juliaup\julia-1.11.5+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\LineEdit.jl:2884
 [4] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
   @ REPL.LineEdit C:\Users\breme\.julia\juliaup\julia-1.11.5+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\LineEdit.jl:2750
 [5] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
   @ REPL C:\Users\breme\.julia\juliaup\julia-1.11.5+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\REPL.jl:1506
 [6] (::REPL.var"#79#85"{REPL.LineEditREPL, REPL.REPLBackendRef})()
   @ REPL C:\Users\breme\.julia\juliaup\julia-1.11.5+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\REPL.jl:497

    nested task error: InterruptException:
    Stacktrace:
     [1] poptask(W::Base.IntrusiveLinkedListSynchronized{Task})
       @ Base .\task.jl:1012
     [2] wait()
       @ Base .\task.jl:1021
     [3] wait(c::Base.GenericCondition{Base.Threads.SpinLock}; first::Bool)
       @ Base .\condition.jl:130
     [4] wait
       @ .\condition.jl:125 [inlined]
     [5] wait_readnb(x::Base.TTY, nb::Int64)
       @ Base .\stream.jl:416
     [6] eof(s::Base.TTY)
       @ Base .\stream.jl:106
     [7] eof(io::REPL.Terminals.TTYTerminal)
       @ Base .\io.jl:472
     [8] (::REPL.LineEdit.var"#282#284"{REPL.Terminals.TTYTerminal, REPL.LineEdit.ModalInterface, REPL.LineEdit.MIState, ReentrantLock, REPL.LineEdit.Prompt})()
       @ REPL.LineEdit C:\Users\breme\.julia\juliaup\julia-1.11.5+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\LineEdit.jl:2850
ERROR: TaskFailedException
Stacktrace:
  [1] try_yieldto(undo::typeof(Base.ensure_rescheduled))
    @ Base .\task.jl:958
  [2] wait()
    @ Base .\task.jl:1022
  [3] wait(c::Base.GenericCondition{ReentrantLock}; first::Bool)
    @ Base .\condition.jl:130
  [4] wait
    @ .\condition.jl:125 [inlined]
  [5] take_buffered(c::Channel{Any})
    @ Base .\channels.jl:493
  [6] take!
    @ .\channels.jl:487 [inlined]
  [7] repl_backend_loop(backend::REPL.REPLBackend, get_module::Function)
    @ REPL C:\Users\breme\.julia\juliaup\julia-1.11.5+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\REPL.jl:353
  [8] start_repl_backend(backend::REPL.REPLBackend, consumer::Any; get_module::Function)
    @ REPL C:\Users\breme\.julia\juliaup\julia-1.11.5+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\REPL.jl:343
  [9] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool, backend::Any)
    @ REPL C:\Users\breme\.julia\juliaup\julia-1.11.5+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\REPL.jl:500
 [10] run_repl(repl::REPL.AbstractREPL, consumer::Any)
    @ REPL C:\Users\breme\.julia\juliaup\julia-1.11.5+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\REPL.jl:486
 [11] (::Base.var"#1150#1152"{Bool, Symbol, Bool})(REPL::Module)
    @ Base .\client.jl:446
 [12] #invokelatest#2
    @ .\essentials.jl:1055 [inlined]
 [13] invokelatest
    @ .\essentials.jl:1052 [inlined]
 [14] run_main_repl(interactive::Bool, quiet::Bool, banner::Symbol, history_file::Bool, color_set::Bool)
    @ Base .\client.jl:430
 [15] repl_main
    @ .\client.jl:567 [inlined]
 [16] _start()
    @ Base .\client.jl:541

    nested task error: TaskFailedException
    Stacktrace:
     [1] wait(t::Task)
       @ Base .\task.jl:370
     [2] fetch
       @ .\task.jl:390 [inlined]
     [3] prompt!(term::REPL.Terminals.TextTerminal, prompt::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
       @ REPL.LineEdit C:\Users\breme\.julia\juliaup\julia-1.11.5+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\LineEdit.jl:2884
     [4] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
       @ REPL.LineEdit C:\Users\breme\.julia\juliaup\julia-1.11.5+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\LineEdit.jl:2750
     [5] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
       @ REPL C:\Users\breme\.julia\juliaup\julia-1.11.5+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\REPL.jl:1506
     [6] (::REPL.var"#79#85"{REPL.LineEditREPL, REPL.REPLBackendRef})()
       @ REPL C:\Users\breme\.julia\juliaup\julia-1.11.5+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\REPL.jl:497

        nested task error: InterruptException:
        Stacktrace:
         [1] poptask(W::Base.IntrusiveLinkedListSynchronized{Task})
           @ Base .\task.jl:1012
         [2] wait()
           @ Base .\task.jl:1021
         [3] wait(c::Base.GenericCondition{Base.Threads.SpinLock}; first::Bool)
           @ Base .\condition.jl:130
         [4] wait
           @ .\condition.jl:125 [inlined]
         [5] wait_readnb(x::Base.TTY, nb::Int64)
           @ Base .\stream.jl:416
         [6] eof(s::Base.TTY)
           @ Base .\stream.jl:106
         [7] eof(io::REPL.Terminals.TTYTerminal)
           @ Base .\io.jl:472
         [8] (::REPL.LineEdit.var"#282#284"{REPL.Terminals.TTYTerminal, REPL.LineEdit.ModalInterface, REPL.LineEdit.MIState, ReentrantLock, REPL.LineEdit.Prompt})()
           @ REPL.LineEdit C:\Users\breme\.julia\juliaup\julia-1.11.5+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\LineEdit.jl:2850

BenjaminRemez avatar Jun 10 '25 14:06 BenjaminRemez

Can you try an old version of cygwin (pre 2021)? They appeared to have introduced a lot of IO bugs in recent years, so we may not really have a way to support cygwin-based tools anymore unfortunately. I tried messaging the cygwin list asking them to revert the bad commits, but got nowhere. c.f. https://github.com/libuv/libuv/issues/4467

vtjnash avatar Jun 10 '25 14:06 vtjnash

I don't have the means to thoroughly test this. It does seem decoupled from the julia version, as it reproduces on julia 1.8 which I use on occasion. I have noticed this now after upgrading my machine, and I don't recall having this issue on my last one, which would have had a ~2020 GitBash installation.

BenjaminRemez avatar Jun 10 '25 15:06 BenjaminRemez

If you can test it, it'd be helpful for more people to report that this commit from mid 2024 (and its predecessors over the years) need to be reverted, and cygwin needs to be rewritten to use something more similar to libuv as the IO layer if they want to try again at this: https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=fc691d0246b95807cd2fac83cceb8053fc295eb2

https://cygwin.com/pipermail/cygwin/2024-July/256272.html

vtjnash avatar Jun 10 '25 15:06 vtjnash

Workaround: Use Windows Terminal. Works perfectly fine with git bash.

ufechner7 avatar Jun 11 '25 03:06 ufechner7