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

Base.require leads to ERROR: LoadError: UndefVarError: UUID not defined in Main #53381

Closed
mortenpi opened this issue Feb 19, 2024 · 3 comments · Fixed by #53387
Closed

Base.require leads to ERROR: LoadError: UndefVarError: UUID not defined in Main #53381

mortenpi opened this issue Feb 19, 2024 · 3 comments · Fixed by #53387

Comments

@mortenpi
Copy link
Contributor

mortenpi commented Feb 19, 2024

This popped up in DataSets.jl nightly tests, and appears to be some weird regression in Base.require. The tarball (mwe.tar.gz) has the MWE environment (which basically consists of a trivial empty package):

$ julia +nightly --project

julia> using UUIDs: UUID

julia> Base.require(Base.PkgId(UUID("89b7a33a-382e-4698-a931-421b088d35a2"), "DummyStorageBackends"))
┌ Info: Precompiling DummyStorageBackends [89b7a33a-382e-4698-a931-421b088d35a2]
└ @ Base loading.jl:2647
ERROR: LoadError: UndefVarError: `UUID` not defined in `Main`
Stacktrace:
 [1] top-level scope
   @ stdin:2
in expression starting at stdin:2
ERROR: Failed to precompile DummyStorageBackends [89b7a33a-382e-4698-a931-421b088d35a2] to "/home/mortenpi/.julia/compiled/v1.12/DummyStorageBackends/jl_TtujDq".
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; flags::Cmd, reasons::Dict{…})
    @ Base ./loading.jl:2762
  [3] (::Base.var"#1069#1070"{Base.PkgId})()
    @ Base ./loading.jl:2204
  [4] mkpidlock(f::Base.var"#1069#1070"{Base.PkgId}, at::String, pid::Int32; kwopts::@Kwargs{stale_age::Int64, wait::Bool})
    @ FileWatching.Pidfile ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/FileWatching/src/pidfile.jl:95
  [5] #mkpidlock#6
    @ ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/FileWatching/src/pidfile.jl:90 [inlined]
  [6] trymkpidlock(::Function, ::Vararg{Any}; kwargs::@Kwargs{stale_age::Int64})
    @ FileWatching.Pidfile ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/FileWatching/src/pidfile.jl:116
  [7] #invokelatest#2
    @ ./essentials.jl:1032 [inlined]
  [8] invokelatest
    @ ./essentials.jl:1027 [inlined]
  [9] maybe_cachefile_lock(f::Base.var"#1069#1070"{Base.PkgId}, pkg::Base.PkgId, srcpath::String; stale_age::Int64)
    @ Base ./loading.jl:3348
 [10] maybe_cachefile_lock
    @ ./loading.jl:3345 [inlined]
 [11] _require(pkg::Base.PkgId, env::Nothing)
    @ Base ./loading.jl:2200
 [12] __require_prelocked(uuidkey::Base.PkgId, env::Nothing)
    @ Base ./loading.jl:2033
 [13] #invoke_in_world#3
    @ ./essentials.jl:1064 [inlined]
 [14] invoke_in_world
    @ ./essentials.jl:1061 [inlined]
 [15] _require_prelocked
    @ ./loading.jl:2024 [inlined]
 [16] _require_prelocked
    @ ./loading.jl:2023 [inlined]
 [17] macro expansion
    @ ./lock.jl:273 [inlined]
 [18] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:2018
 [19] top-level scope
    @ REPL[2]:1
Some type information was truncated. Use `show(err)` to see complete types.

Works file on 1.10 and earlier. Looking at the PkgEval results for DataSets.jl, it looks like it started failing about 1-2 weeks ago. I'll see if I can bisect it to a commit.

julia> versioninfo()
Julia Version 1.12.0-DEV.15
Commit 1c25d93ca8a (2024-02-19 01:35 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 × 12th Gen Intel(R) Core(TM) i7-1260P
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, alderlake)
Threads: 1 default, 0 interactive, 1 GC (on 16 virtual cores)
@mortenpi
Copy link
Contributor Author

Bisect blames #53111

@KristofferC
Copy link
Sponsor Member

KristofferC commented Feb 19, 2024

The reason is the following:

julia> pkgid = Base.PkgId(Base.UUID("89b7a33a-382e-4698-a931-421b088d35a2"), "DummyStorageBackends");

julia> show(pkgid)
Base.PkgId(Base.UUID("89b7a33a-382e-4698-a931-421b088d35a2"), "DummyStorageBackends")

julia> using UUIDs: UUID

# `Base` prefix is gone for `UUID`:
julia> show(pkgid)
Base.PkgId(UUID("89b7a33a-382e-4698-a931-421b088d35a2"), "DummyStorageBackends")

This makes

Base.track_nested_precomp($(vcat(Base.precompilation_stack, pkg)))
not print the required Base prefix for the code which will be executed in Main in another process. cc @IanButterworth

@KristofferC
Copy link
Sponsor Member

KristofferC commented Feb 19, 2024

This is pretty much the exact bug as #42329 :) (which also makes this a great example of #29466)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants