Skip to content

Conversation

@mkitti
Copy link
Contributor

@mkitti mkitti commented Feb 19, 2024

catch IOError when using REPL.Terminals.raw!,Fix JuliaDebug/Cthulhu.jl#541

This allows Cthulhu.jl to precompile with Julia release-1.11 branch.

Fix JuliaDebug/Cthulhu.jl#541

This allows Cthulhu.jl to precompile with Julia release-1.11 branch.
@vchuravy
Copy link
Member

Do we know what upstream change broke this?

@mkitti
Copy link
Contributor Author

mkitti commented Feb 19, 2024

I do not know which upstream change caused this. The triggering code only seems to cause a problem during precompilation.

using PrecompileTools
@setup_workload begin
    input = Base.link_pipe!(Pipe(), reader_supports_async=true, writer_supports_async=true)
    term = REPL.Terminals.TTYTerminal("dumb", input.out, devnull, devnull)
    write(input.in, 'q')
    descend(gcd, (Int, Int); terminal=term)
    # declare we are done with streams
    close(input.in)
end

Executing this on release-1.11 does not result in an error.

using Cthulhu, REPL

function cthulhu_541()
    input = Base.link_pipe!(Pipe(), reader_supports_async=true, writer_supports_async=true)
    term = REPL.Terminals.TTYTerminal("dumb", input.out, devnull, devnull)
    write(input.in, 'q')
    descend(gcd, (Int, Int); terminal=term)
    # declare we are done with streams
    close(input.in)
end

cthulhu_541()

write(input.in, 'q') leads to closure of the stream.

I traced the closure of the stream using this function.

function Base.setproperty!(io::Base.PipeEndpoint, x::Symbol, v)
    @async begin
        if x === :status && v === Base.StatusClosing
            @info "setproperty!(::PipeEndpoint, ...)" io x v
            Base.show_backtrace(stdout, backtrace())
        end
    end
    invoke(Base.setproperty!, Tuple{Base.LibuvStream, Symbol, typeof(v)}, io, x, v)
end
Stacktrace:
  [1] setproperty!
    @ ~/.julia/dev/Cthulhu/src/Cthulhu.jl:883 [inlined]
  [2] (::Base.var"#readcb_specialized#818")(stream::Base.PipeEndpoint, nread::Int64, nrequested::UInt64)
    @ Base ./stream.jl:679
  [3] uv_readcb(handle::Ptr{Nothing}, nread::Int64, buf::Ptr{Nothing})
    @ Base ./stream.jl:709
  [4] process_events
    @ ./libuv.jl:125 [inlined]
  [5] wait()
    @ Base ./task.jl:1009
  [6] wait(c::Base.GenericCondition{Base.Threads.SpinLock}; first::Bool)
    @ Base ./condition.jl:130
  [7] wait
    @ ./condition.jl:125 [inlined]
  [8] wait_readnb(x::Base.PipeEndpoint, nb::Int64)
    @ Base ./stream.jl:416
  [9] eof(s::Base.PipeEndpoint)
    @ Base ./stream.jl:106
 [10] read(this::Base.PipeEndpoint, ::Type{UInt8})
    @ Base ./stream.jl:1001
 [11] read(io::Base.PipeEndpoint, ::Type{Char})
    @ Base ./io.jl:961
 [12] readbyte
    @ ~/src/julia/usr/share/julia/stdlib/v1.11/REPL/src/TerminalMenus/util.jl:15 [inlined]
 [13] _readkey(stream::Base.PipeEndpoint)
    @ REPL.TerminalMenus ~/src/julia/usr/share/julia/stdlib/v1.11/REPL/src/TerminalMenus/util.jl:22
 [14] readkey(stream::Base.PipeEndpoint)
    @ REPL.TerminalMenus ~/src/julia/usr/share/julia/stdlib/v1.11/REPL/src/TerminalMenus/util.jl:20
 [15] request(term::REPL.Terminals.TTYTerminal, m::Cthulhu.CthulhuMenu; cursor::Int64, suppress_output::Bool)
    @ REPL.TerminalMenus ~/src/julia/usr/share/julia/stdlib/v1.11/REPL/src/TerminalMenus/AbstractMenu.jl:204
 [16] request
    @ ~/src/julia/usr/share/julia/stdlib/v1.11/REPL/src/TerminalMenus/AbstractMenu.jl:181 [inlined]
 [17] request(term::REPL.Terminals.TTYTerminal, msg::String, m::Cthulhu.CthulhuMenu; kwargs::@Kwargs{})
    @ REPL.TerminalMenus ~/src/julia/usr/share/julia/stdlib/v1.11/REPL/src/TerminalMenus/AbstractMenu.jl:262
 [18] request(term::REPL.Terminals.TTYTerminal, msg::String, m::Cthulhu.CthulhuMenu)
    @ REPL.TerminalMenus ~/src/julia/usr/share/julia/stdlib/v1.11/REPL/src/TerminalMenus/AbstractMenu.jl:260
 [19] _descend(term::REPL.Terminals.TTYTerminal, interp::Cthulhu.CthulhuInterpreter, curs::Cthulhu.CthulhuCursor; override::Nothing, debuginfo::Symbol, optimize::Bool, interruptexc::Bool, iswarn::Bool, hide_type_stable::Bool, verbose::Nothing, remarks::Bool, with_effects::Bool, exception_type::Bool, inline_cost::Bool, type_annotations::Bool, annotate_source::Bool, inlay_types_vscode::Bool, diagnostics_vscode::Bool, jump_always::Bool)
    @ Cthulhu ~/.julia/dev/Cthulhu/src/Cthulhu.jl:561
 [20] _descend(term::REPL.Terminals.TTYTerminal, interp::Cthulhu.CthulhuInterpreter, mi::Core.MethodInstance; kwargs::@Kwargs{iswarn::Bool})
    @ Cthulhu ~/.julia/dev/Cthulhu/src/Cthulhu.jl:791
 [21] _descend(term::REPL.Terminals.TTYTerminal, args::Any; interp::Core.Compiler.NativeInterpreter, kwargs::@Kwargs{iswarn::Bool})
    @ Cthulhu ~/.julia/dev/Cthulhu/src/Cthulhu.jl:807
 [22] __descend_with_error_handling(args::Any; terminal::Any, kwargs...)
    @ Cthulhu ~/.julia/dev/Cthulhu/src/Cthulhu.jl:222
 [23] _descend_with_error_handling(f::Any, argtypes::Any; kwargs::@Kwargs{iswarn::Bool, terminal::REPL.Terminals.TTYTerminal})
    @ Cthulhu ~/.julia/dev/Cthulhu/src/Cthulhu.jl:211
 [24] descend_code_typed(::Any, ::Vararg{Any}; kwargs::@Kwargs{terminal::REPL.Terminals.TTYTerminal})
    @ Cthulhu ~/.julia/dev/Cthulhu/src/Cthulhu.jl:169

@mkitti
Copy link
Contributor Author

mkitti commented Feb 19, 2024

Note that this change aims to make the Julia release-1.11 branch compatible with Cthulhu.jl v2.11.0. It does not resolve all the issues on the master branch of Julia due to issues outlined in JuliaDebug/Cthulhu.jl#547 .

@mkitti
Copy link
Contributor Author

mkitti commented Feb 19, 2024

@KristofferC please backport to release-1.11

@KristofferC
Copy link
Member

Imo, we should try figure out a bit more about what happened here. Catching an error and just ignoring it feels a bit odd since presumably something is going wrong then?

@mkitti
Copy link
Contributor Author

mkitti commented Feb 19, 2024

I will bisect. Could someone remind me how the list the available nightlies so I can establish some coarse bounds?

That said I still think we should do some error handling as I have done here. We are merely trying to reset raw mode on a TTY terminal. What is the point of failing when the underlying streams are already closed?

@mkitti
Copy link
Contributor Author

mkitti commented Feb 20, 2024

The following works just fine.

julia> using Cthulhu

julia> versioninfo()
Julia Version 1.11.0-DEV.1550
Commit 604609a3fc* (2024-02-10 19:26 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × AMD FX(tm)-8350 Eight-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, bdver1)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)

julia> using Pkg

julia> pkg"status"
Status `~/.julia/environments/v1.11/Project.toml`
  [f68482b8] Cthulhu v2.11.0

julia> pkg"status -m"
Status `~/.julia/environments/v1.11/Manifest.toml`
  [1520ce14] AbstractTrees v0.4.4
  [da1fd8a2] CodeTracking v1.3.5
  [f68482b8] Cthulhu v2.11.0
  [1eca21be] FoldingTrees v1.2.1
  [70703baa] JuliaSyntax v0.4.8
  [aea7be01] PrecompileTools v1.2.0
  [21216c6a] Preferences v1.4.1
  [d265eb64] TypedSyntax v1.2.4
  [b8c1c048] WidthLimitedIO v1.0.1
  [2a0f44e3] Base64 v1.11.0
  [ade2ca70] Dates v1.11.0
  [b77e0a4c] InteractiveUtils v1.11.0
  [d6f4376e] Markdown v1.11.0
  [de0858da] Printf v1.11.0
  [3fa0cd96] REPL v1.11.0
  [9a3f8284] Random v1.11.0
  [ea8e919c] SHA v0.7.0
  [6462fe0b] Sockets v1.11.0
  [f489334b] StyledStrings v1.11.0
  [fa267f1f] TOML v1.0.3
  [cf7118a7] UUIDs v1.11.0
  [4ec0a83e] Unicode v1.11.0

julia> ccall(:uv_version, Cuint, ())
0x00020000

julia> ccall(:uv_version_string, Cstring, ()) |> unsafe_string
"2.0.0-dev"

@mkitti
Copy link
Contributor Author

mkitti commented Feb 20, 2024

I suspect the issue is the libuv upgrade:
#49937

This entered master as e5496e0 which is right after 604609a which works (see above).

@mkitti
Copy link
Contributor Author

mkitti commented Feb 20, 2024

One observation of why this issue did not occur before is that under 604609a the call to raw! encounters term.in_stream.status with status 8 or Base.StatusPaused. The call to change the status to 5 or Base.StatusClosing does not come until after the call to raw!.

julia> using Cthulhu
┌ Info: Precompiling Cthulhu [f68482b8-f384-11e8-15f7-abe071a5a75f] (cache misses: wrong dep version loaded (1), invalid header (2))
└ @ Base loading.jl:2600
┌ Info: disabling raw mode
│   term.in_stream.status = 8
└ @ REPL.TerminalMenus /home/mkitti/src/julia/usr/share/julia/stdlib/v1.11/REPL/src/TerminalMenus/AbstractMenu.jl:241
┌ Info: setproperty!(::PipeEndpoint, ...)
│   io = Base.PipeEndpoint(RawFD(-1) closing, 0 bytes waiting)
│   x = status
│   v = 5
└ @ Cthulhu /home/mkitti/.julia/dev/Cthulhu/src/Cthulhu.jl:880

The problem occurs now on master because the status is changed to Base.StatusClosing before the call to raw!.

@mkitti
Copy link
Contributor Author

mkitti commented Feb 20, 2024

I can confirm that the issue was introduced with e5496e0 (#49937)

julia> versioninfo()
Julia Version 1.11.0-DEV.1551
Commit e5496e0d17* (2024-02-10 20:26 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × AMD FX(tm)-8350 Eight-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, bdver1)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)


julia> using Cthulhu
┌ Info: Precompiling Cthulhu [f68482b8-f384-11e8-15f7-abe071a5a75f] (cache misses: invalid header (3))
└ @ Base loading.jl:2600
┌ Info: setproperty!(::PipeEndpoint, ...)
│   io = Base.PipeEndpoint(RawFD(-1) closing, 0 bytes waiting)
│   x = status
│   v = 5
└ @ Cthulhu /home/mkitti/.julia/dev/Cthulhu/src/Cthulhu.jl:880

Stacktrace:┌ Info: disabling raw mode
│   term.in_stream.status = 6
└ @ REPL.TerminalMenus /home/mkitti/src/julia/usr/share/julia/stdlib/v1.11/REPL/src/TerminalMenus/AbstractMenu.jl:241
┌ Info: setproperty!(::PipeEndpoint, ...)
│   io = Base.PipeEndpoint(RawFD(-1) closed, 0 bytes waiting)
│   x = status
│   v = 5
└ @ Cthulhu /home/mkitti/.julia/dev/Cthulhu/src/Cthulhu.jl:880

ERROR:  LoadError: [1]IOError:  stream is closed or unusable
Stacktrace:(::Cthulhu.var"#118#119"{Base.PipeEndpoint, Symbol, Int64})()
Stacktrace:

    @ [1]  [1] Cthulhu (::Cthulhu.var"#118#119"{Base.PipeEndpoint, Symbol, Int64})() check_open(x::Base.PipeEndpoint)
~/.julia/dev/Cthulhu/src/
   @Cthulhu.jl:881    @  CthulhuBase  ~/.julia/dev/Cthulhu/src/./Cthulhu.jl:881stream.jl:388
  [2] raw!(t::REPL.Terminals.TTYTerminal, raw::Bool)
    @ REPL.Terminals ~/src/julia/usr/share/julia/stdlib/v1.11/REPL/src/Terminals.jl:138
  [3] request(term::REPL.Terminals.TTYTerminal, m::Cthulhu.CthulhuMenu; cursor::Int64, suppress_output::Bool)
    @ REPL.TerminalMenus ~/src/julia/usr/share/julia/stdlib/v1.11/REPL/src/TerminalMenus/AbstractMenu.jl:242
  [4] request
    @ ~/src/julia/usr/share/julia/stdlib/v1.11/REPL/src/TerminalMenus/AbstractMenu.jl:181 [inlined]
  [5] request(term::REPL.Terminals.TTYTerminal, msg::String, m::Cthulhu.CthulhuMenu; kwargs::@Kwargs{})
    @ REPL.TerminalMenus ~/src/julia/usr/share/julia/stdlib/v1.11/REPL/src/TerminalMenus/AbstractMenu.jl:260
  [6] request(term::REPL.Terminals.TTYTerminal, msg::String, m::Cthulhu.CthulhuMenu)
    @ REPL.TerminalMenus ~/src/julia/usr/share/julia/stdlib/v1.11/REPL/src/TerminalMenus/AbstractMenu.jl:258
  [7] _descend(term::REPL.Terminals.TTYTerminal, interp::Cthulhu.CthulhuInterpreter, curs::Cthulhu.CthulhuCursor; override::Nothing, debuginfo::Symbol, optimize::Bool, interruptexc::Bool, iswarn::Bool, hide_type_stable::Bool, verbose::Nothing, remarks::Bool, with_effects::Bool, exception_type::Bool, inline_cost::Bool, type_annotations::Bool, annotate_source::Bool, inlay_types_vscode::Bool, diagnostics_vscode::Bool, jump_always::Bool)
    @ Cthulhu ~/.julia/dev/Cthulhu/src/Cthulhu.jl:561
  [8] _descend(term::REPL.Terminals.TTYTerminal, interp::Cthulhu.CthulhuInterpreter, mi::Core.MethodInstance; kwargs::@Kwargs{iswarn::Bool})
    @ Cthulhu ~/.julia/dev/Cthulhu/src/Cthulhu.jl:791
  [9] _descend(term::REPL.Terminals.TTYTerminal, args::Any; interp::Core.Compiler.NativeInterpreter, kwargs::@Kwargs{iswarn::Bool})
    @ Cthulhu ~/.julia/dev/Cthulhu/src/Cthulhu.jl:807
 [10] __descend_with_error_handling(args::Any; terminal::Any, kwargs...)
    @ Cthulhu ~/.julia/dev/Cthulhu/src/Cthulhu.jl:222
 [11] _descend_with_error_handling(f::Any, argtypes::Any; kwargs::@Kwargs{iswarn::Bool, terminal::REPL.Terminals.TTYTerminal})
    @ Cthulhu ~/.julia/dev/Cthulhu/src/Cthulhu.jl:211
 [12] descend_code_typed(::Any, ::Vararg{Any}; kwargs::@Kwargs{terminal::REPL.Terminals.TTYTerminal})
    @ Cthulhu ~/.julia/dev/Cthulhu/src/Cthulhu.jl:169
 [13] macro expansion
    @ ~/.julia/dev/Cthulhu/src/Cthulhu.jl:895 [inlined]
 [14] macro expansion
    @ ~/.julia/packages/PrecompileTools/kmH5L/src/workloads.jl:78 [inlined]
 [15] macro expansion
    @ ~/.julia/dev/Cthulhu/src/Cthulhu.jl:894 [inlined]
 [16] macro expansion
    @ ~/.julia/packages/PrecompileTools/kmH5L/src/workloads.jl:140 [inlined]
 [17] top-level scope
    @ ~/.julia/dev/Cthulhu/src/Cthulhu.jl:888
 [18] include
    @ ./Base.jl:556 [inlined]
 [19] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
    @ Base ./loading.jl:2438
 [20] top-level scope
    @ stdin:4
in expression starting at /home/mkitti/.julia/dev/Cthulhu/src/Cthulhu.jl:1
in expression starting at stdin:4
ERROR: Failed to precompile Cthulhu [f68482b8-f384-11e8-15f7-abe071a5a75f] to "/home/mkitti/.julia/compiled/v1.11/Cthulhu/jl_SjRD25".
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool; reasons::Dict{String, Int64})
    @ Base ./loading.jl:2715
  [3] compilecache
    @ ./loading.jl:2582 [inlined]
  [4] (::Base.var"#1063#1064"{Base.PkgId})()
    @ Base ./loading.jl:2158
  [5] mkpidlock(f::Base.var"#1063#1064"{Base.PkgId}, at::String, pid::Int32; kwopts::@Kwargs{stale_age::Int64, wait::Bool})
    @ FileWatching.Pidfile ~/src/julia/usr/share/julia/stdlib/v1.11/FileWatching/src/pidfile.jl:95
  [6] #mkpidlock#6
    @ ~/src/julia/usr/share/julia/stdlib/v1.11/FileWatching/src/pidfile.jl:90 [inlined]
  [7] trymkpidlock(::Function, ::Vararg{Any}; kwargs::@Kwargs{stale_age::Int64})
    @ FileWatching.Pidfile ~/src/julia/usr/share/julia/stdlib/v1.11/FileWatching/src/pidfile.jl:116
  [8] #invokelatest#2
    @ ./essentials.jl:1027 [inlined]
  [9] invokelatest
    @ ./essentials.jl:1022 [inlined]
 [10] maybe_cachefile_lock(f::Base.var"#1063#1064"{Base.PkgId}, pkg::Base.PkgId, srcpath::String; stale_age::Int64)
    @ Base ./loading.jl:3301
 [11] maybe_cachefile_lock
    @ ./loading.jl:3298 [inlined]
 [12] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:2154
 [13] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1987
 [14] #invoke_in_world#3
    @ ./essentials.jl:1059 [inlined]
 [15] invoke_in_world
    @ ./essentials.jl:1056 [inlined]
 [16] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1978
 [17] macro expansion
    @ ./loading.jl:1916 [inlined]
 [18] macro expansion
    @ ./lock.jl:273 [inlined]
 [19] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1873
 [20] #invoke_in_world#3
    @ ./essentials.jl:1059 [inlined]
 [21] invoke_in_world
    @ ./essentials.jl:1056 [inlined]
 [22] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1866

julia> using Pkg
[ Info: Precompiling REPLExt [e5eb5ef1-03cf-53a7-ae1d-5a66b08e832b] (cache misses: invalid header (6), mismatched flags (2), dep uuid changed (2))

julia> pkg"status"
Status `~/.julia/environments/v1.11/Project.toml`
  [f68482b8] Cthulhu v2.11.0 `~/.julia/dev/Cthulhu`

julia> pkg"status -m"
Status `~/.julia/environments/v1.11/Manifest.toml`
  [1520ce14] AbstractTrees v0.4.4
  [da1fd8a2] CodeTracking v1.3.5
  [f68482b8] Cthulhu v2.11.0 `~/.julia/dev/Cthulhu`
  [1eca21be] FoldingTrees v1.2.1
  [70703baa] JuliaSyntax v0.4.8
  [aea7be01] PrecompileTools v1.2.0
  [21216c6a] Preferences v1.4.1
  [d265eb64] TypedSyntax v1.2.4
  [b8c1c048] WidthLimitedIO v1.0.1
  [2a0f44e3] Base64 v1.11.0
  [ade2ca70] Dates v1.11.0
  [b77e0a4c] InteractiveUtils v1.11.0
  [d6f4376e] Markdown v1.11.0
  [de0858da] Printf v1.11.0
  [3fa0cd96] REPL v1.11.0
  [9a3f8284] Random v1.11.0
  [ea8e919c] SHA v0.7.0
  [6462fe0b] Sockets v1.11.0
  [f489334b] StyledStrings v1.11.0
  [fa267f1f] TOML v1.0.3
  [cf7118a7] UUIDs v1.11.0
  [4ec0a83e] Unicode v1.11.0

@mkitti
Copy link
Contributor Author

mkitti commented Feb 20, 2024

An alternative fix involves checking for isopen and term.in_stream.status != Base.StatusClosing:

in_stream = pipe_reader(term)
if isopen(in_stream) && in_stream.status != Base.StatusClosing
    REPL.Terminals.raw!(term, false)
end

I do not like that low-level libuv implementation details are leaking across abstraction barriers though.

Another option is to define isopen to not include the status Base.StatusClosing:

julia/base/stream.jl

Lines 379 to 390 in 02699bb

function isopen(x::Union{LibuvStream, LibuvServer})
if x.status == StatusUninit || x.status == StatusInit || x.handle === C_NULL
throw(ArgumentError("$x is not initialized"))
end
return x.status != StatusClosed
end
function check_open(x::Union{LibuvStream, LibuvServer})
if !isopen(x) || x.status == StatusClosing
throw(IOError("stream is closed or unusable", 0))
end
end

 function isopen(x::Union{LibuvStream, LibuvServer}) 
     if x.status == StatusUninit || x.status == StatusInit || x.handle === C_NULL 
         throw(ArgumentError("$x is not initialized")) 
     end 
     return x.status != StatusClosed && x.status != StatusClosing
 end 
  
 function check_open(x::Union{LibuvStream, LibuvServer}) 
     if !isopen(x)
         throw(IOError("stream is closed or unusable", 0)) 
     end 
 end 

Then could use this shorter snippet..

if isopen(term.in_stream)
    REPL.Terminals.raw!(term, false)
end

I went with the catching the IOError approach for the following reasons:

  1. The details about IO stream status are kept within stream.jl in Base.
  2. No API changes are needed to Base.
  3. Known exceptions should be handled when possible, not rethrown.
  4. In the case that the IO stream is closed, the point of disabling raw mode is moot. Thus, we know how to handle the specific error in question.

@KristofferC
Copy link
Member

Thanks for the detailed investigation. So maybe just ignoring raw! on a closed stream is indeed the simplest.

@mkitti
Copy link
Contributor Author

mkitti commented Feb 20, 2024

Should there be a method is_not_closed_or_closing?

That probably should just be isopen. The "closing" status is just a transient state as we wait for a callback from libuv.

@vtjnash
Copy link
Member

vtjnash commented Feb 20, 2024

This is probably a libuv bug, though there is a small change it might be a kernel bug (I am still investigating with strace). It therefore can be worked around with UV_USE_IO_URING=0 and will not be possible to reproduce with rr

@mkitti
Copy link
Contributor Author

mkitti commented Feb 20, 2024

Thanks for the detailed investigation. So maybe just ignoring raw! on a closed stream is indeed the simplest.

The problem is that the stream is technically still open. It's closing, Base.StatusClosing, which means the following.

  1. The stream is still open, according to isopen.
  2. The stream is not closed.
  3. checkopen will still throw an error.

Should we reconcile isopen and check_open above? It is not clear to me why a Base.StatusClosing stream is not effectively closed (e.g. not open).

I think this is an orthogonal issue to the low-level libuv problems.

@vtjnash
Copy link
Member

vtjnash commented Feb 21, 2024

The problem is that the stream is technically still open

That is a bit murky unfortunately. The kernel reported that the pipe was closed, but actually it wasn't closed. So libuv reported that the pipe was closed, even though the kernel lied about that, libuv didn't know that. So Julia reported that the pipe was closed, even though that was a lie from the kernel, it would be fairly hard for Julia to realize that was a lie, and fairly costly to have checked

@Keno
Copy link
Member

Keno commented Mar 23, 2024

Fixed by libuv bump

@Keno Keno closed this Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Precompilation error on julia master due to IOError: stream is closed

5 participants