JuliaLang / Pkg.jl

Pkg - Package manager for the Julia programming language
https://pkgdocs.julialang.org
Other
616 stars 258 forks source link

missing API method closewrite for Pkg.UnstableIO #3722

Closed vtjnash closed 4 months ago

vtjnash commented 8 months ago

The UnstableIO type is missing the closewrite method which causes it to throw this error (which gets usually swallowed by precompile, but here I made it visible while checking for API mistakes)

    nested task error: MethodError: no method matching closewrite(::Pkg.UnstableIO)

    Closest candidates are:
      closewrite(!Matched::Base.BufferStream)
       @ Base stream.jl:1487
      closewrite(!Matched::Base.LibuvStream)
       @ Base stream.jl:437
      closewrite(!Matched::Base.GenericIOBuffer)
       @ Base iobuffer.jl:350
      ...

    Stacktrace:
     [1] (::Base.var"#848#849"{Pkg.UnstableIO, Bool, Base.PipeEndpoint, Pkg.UnstableIO, Base.PipeEndpoint})()
       @ Base ./process.jl:318
in expression starting at /home/vtjnash/julia/usr/share/julia/stdlib/v1.11/Pkg/src/precompile.jl:6
in expression starting at /home/vtjnash/julia/usr/share/julia/stdlib/v1.11/Pkg/src/Pkg.jl:3
in expression starting at stdin:3
KristofferC commented 8 months ago

When does this occur?

vtjnash commented 8 months ago

At that point of precompile, it just usually happens in Task that is missing an errormonitor so you miss it

KristofferC commented 8 months ago

I haven't seen this in any real usage of Pkg, so what call happens on the IO where this has to be implemented?

vtjnash commented 8 months ago

It always happens, we just currently usually swallow the error tetx

vtjnash commented 8 months ago

It also probably means there is a data race and concurrency violation currently, as this error means Pkg is reading the stdout result before it is fully written on another thread (which I hope to fix on master though for v1.11)