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

fail to load value that is a Dict during precompile #16

Closed
Roger-luo opened this issue Jun 21, 2021 · 2 comments · Fixed by JuliaLang/julia#41294
Closed

fail to load value that is a Dict during precompile #16

Roger-luo opened this issue Jun 21, 2021 · 2 comments · Fixed by JuliaLang/julia#41294

Comments

@Roger-luo
Copy link

Roger-luo commented Jun 21, 2021

one can create a package to test this, the Project.toml looks like following

name = "PkgModule"
uuid = "81468456-a077-41e9-90c9-0e047517ca6f"
authors = ["Roger-Luo <rogerluo.rl18@gmail.com> and contributors"]
version = "0.1.0"

[deps]
Preferences = "21216c6a-2e73-6563-6e65-726566657250"

[compat]
julia = "1.6.1"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[preferences.PkgModule.color]
name = "light_blue"

[targets]
test = ["Test"]

the src/PkgModule.jl looks like this

module PkgModule

using Preferences

# uncomment the following to reproduce error
# const color = @load_preference("color")
# const color = load_preference(PkgModule, "color")

end

while I'm expecting color to be loaded as a Dict, but I'm getting

julia> using PkgModule
[ Info: Precompiling PkgModule [81468456-a077-41e9-90c9-0e047517ca6f]
fatal: error thrown and no exception handler available.
TypeError(func=:typeassert, context="", expected=Union{Nothing, String}, got=Base.Dict{String, Any}(slots=Array{UInt8, (16,)}[0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], keys=Array{String, (16,)}[
  #<null>,
  "name",
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>], vals=Array{Any, (16,)}[
  #<null>,
  "light_blue",
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>,
  #<null>], ndel=0, count=1, age=0x0000000000000001, idxfloor=2, maxprobe=0))
jl_type_error_rt at /buildworker/worker/package_linux64/build/src/rtutils.c:119
jl_type_error at /buildworker/worker/package_linux64/build/src/rtutils.c:127
get_preferences_hash at ./loading.jl:1662
get_preferences_hash at ./loading.jl:1671
jfptr_get_preferences_hash_50003.clone_1 at /home/roger/.ion/packages/julia-1.6/julia-1.6.1/lib/julia/sys.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2237 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2419
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
write_dependency_list at /buildworker/worker/package_linux64/build/src/dump.c:1150 [inlined]
jl_save_incremental at /buildworker/worker/package_linux64/build/src/dump.c:2139
jl_write_compiler_output at /buildworker/worker/package_linux64/build/src/precompile.c:65
jl_atexit_hook at /buildworker/worker/package_linux64/build/src/init.c:211
repl_entrypoint at /buildworker/worker/package_linux64/build/src/jlapi.c:703
main at /buildworker/worker/package_linux64/build/cli/loader_exe.c:51
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
_start at /home/roger/.ion/packages/julia-1.6/julia-1.6.1/bin/julia (unknown line)
ERROR: Failed to precompile PkgModule [81468456-a077-41e9-90c9-0e047517ca6f] to /home/roger/.julia/compiled/v1.6/PkgModule/jl_84dbrq.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::Base.TTY, internal_stdout::Base.TTY)
    @ Base ./loading.jl:1360
  [3] compilecache(pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1306
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1021
  [5] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:914
  [6] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:901
  [7] eval
    @ ./boot.jl:360 [inlined]
  [8] eval
    @ ./Base.jl:39 [inlined]
  [9] repleval(m::Module, code::Expr, #unused#::String)
    @ VSCodeServer ~/.vscode-server/extensions/julialang.language-julia-1.2.5/scripts/packages/VSCodeServer/src/repl.jl:149

however, this works with using Preference in the REPL

julia> using Preferences

julia> load_preference(PkgModule, "color")
Dict{String, Any} with 1 entry:
  "name" => "light_blue"
@Roger-luo
Copy link
Author

versioninfo

julia> versioninfo()
Julia Version 1.6.1
Commit 6aaedecc44 (2021-04-23 05:59 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD Ryzen 9 3900X 12-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, znver2)

@Roger-luo
Copy link
Author

It seems to be caused by JuliaLang/julia#38285

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 a pull request may close this issue.

1 participant