Closed ndortega closed 2 months ago
This errors on a following line in PeaceFounderAdmin:
spec = Mapper.BRAID_CHAIN.ledger[index]
Here Mapper
is imported from PeaceFounder and BRAID_CHAIN
is a global mutable variable there initialized at runtime. The full error is as follows:
julia> using PeaceFounderAdmin
Precompiling PeaceFounderAdmin
Info Given PeaceFounderAdmin was explicitly requested, output will be shown live
ERROR: LoadError: UndefVarError: `BRAID_CHAIN` not defined
Stacktrace:
[1] getargvalue
@ ~/.julia/packages/Oxygen/IQnes/src/reflection.jl:12 [inlined]
[2] splitargs(args::Vector{GlobalRef}, func_name::Symbol)
@ Oxygen.Core.Reflection ~/.julia/packages/Oxygen/IQnes/src/reflection.jl:79
[3] extract_defaults(info::Vector{Core.CodeInfo}, func_name::Symbol, param_names::Vector{Symbol}, kwarg_names::Vector{Symbol}; start::Int64)
@ Oxygen.Core.Reflection ~/.julia/packages/Oxygen/IQnes/src/reflection.jl:238
[4] extract_defaults
@ ~/.julia/packages/Oxygen/IQnes/src/reflection.jl:225 [inlined]
[5] splitdef(f::Function; start::Int64)
@ Oxygen.Core.Reflection ~/.julia/packages/Oxygen/IQnes/src/reflection.jl:274
[6] splitdef
@ ~/.julia/packages/Oxygen/IQnes/src/reflection.jl:262 [inlined]
[7] parse_func_params(route::String, func::Function)
@ Oxygen.Core ~/.julia/packages/Oxygen/IQnes/src/core.jl:435
[8] register(ctx::Oxygen.Core.AppContext.Context, httpmethod::String, route::String, func::Function)
@ Oxygen.Core ~/.julia/packages/Oxygen/IQnes/src/core.jl:493
[9] route(methods::Vector{String}, path::String, func::Function)
@ PeaceFounderAdmin.AdminService ~/.julia/packages/Oxygen/IQnes/src/methods.jl:216
[10] top-level scope
@ ~/BtSync/PeaceFounder/Github/PeaceFounderAdmin/src/braidchain.jl:78
[11] include(mod::Module, _path::String)
@ Base ./Base.jl:495
[12] include(x::String)
@ PeaceFounderAdmin ~/BtSync/PeaceFounder/Github/PeaceFounderAdmin/src/PeaceFounderAdmin.jl:1
[13] top-level scope
@ ~/BtSync/PeaceFounder/Github/PeaceFounderAdmin/src/PeaceFounderAdmin.jl:22
[14] include
@ ./Base.jl:495 [inlined]
[15] 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:2222
[16] top-level scope
@ stdin:3
in expression starting at /Users/jerdmanis/BtSync/PeaceFounder/Github/PeaceFounderAdmin/src/braidchain.jl:78
in expression starting at /Users/jerdmanis/BtSync/PeaceFounder/Github/PeaceFounderAdmin/src/PeaceFounderAdmin.jl:1
in expression starting at stdin:3
✗ PeaceFounderAdmin
0 dependencies successfully precompiled in 4 seconds. 73 already precompiled.
ERROR: The following 1 direct dependency failed to precompile:
PeaceFounderAdmin [71cbcc19-d5de-42ce-8f1e-a2372a8e1f1c]
Failed to precompile PeaceFounderAdmin [71cbcc19-d5de-42ce-8f1e-a2372a8e1f1c] to "/Users/jerdmanis/.julia/compiled/v1.10/PeaceFounderAdmin/jl_3yKc5Z".
ERROR: LoadError: UndefVarError: `BRAID_CHAIN` not defined
Stacktrace:
[1] getargvalue
@ ~/.julia/packages/Oxygen/IQnes/src/reflection.jl:12 [inlined]
[2] splitargs(args::Vector{GlobalRef}, func_name::Symbol)
@ Oxygen.Core.Reflection ~/.julia/packages/Oxygen/IQnes/src/reflection.jl:79
[3] extract_defaults(info::Vector{Core.CodeInfo}, func_name::Symbol, param_names::Vector{Symbol}, kwarg_names::Vector{Symbol}; start::Int64)
@ Oxygen.Core.Reflection ~/.julia/packages/Oxygen/IQnes/src/reflection.jl:238
[4] extract_defaults
@ ~/.julia/packages/Oxygen/IQnes/src/reflection.jl:225 [inlined]
[5] splitdef(f::Function; start::Int64)
@ Oxygen.Core.Reflection ~/.julia/packages/Oxygen/IQnes/src/reflection.jl:274
[6] splitdef
@ ~/.julia/packages/Oxygen/IQnes/src/reflection.jl:262 [inlined]
[7] parse_func_params(route::String, func::Function)
@ Oxygen.Core ~/.julia/packages/Oxygen/IQnes/src/core.jl:435
[8] register(ctx::Oxygen.Core.AppContext.Context, httpmethod::String, route::String, func::Function)
@ Oxygen.Core ~/.julia/packages/Oxygen/IQnes/src/core.jl:493
[9] route(methods::Vector{String}, path::String, func::Function)
@ PeaceFounderAdmin.AdminService ~/.julia/packages/Oxygen/IQnes/src/methods.jl:216
[10] top-level scope
@ ~/BtSync/PeaceFounder/Github/PeaceFounderAdmin/src/braidchain.jl:78
[11] include(mod::Module, _path::String)
@ Base ./Base.jl:495
[12] include(x::String)
@ PeaceFounderAdmin ~/BtSync/PeaceFounder/Github/PeaceFounderAdmin/src/PeaceFounderAdmin.jl:1
[13] top-level scope
@ ~/BtSync/PeaceFounder/Github/PeaceFounderAdmin/src/PeaceFounderAdmin.jl:22
[14] include
@ ./Base.jl:495 [inlined]
[15] 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:2222
[16] top-level scope
@ stdin:3
in expression starting at /Users/jerdmanis/BtSync/PeaceFounder/Github/PeaceFounderAdmin/src/braidchain.jl:78
in expression starting at /Users/jerdmanis/BtSync/PeaceFounder/Github/PeaceFounderAdmin/src/PeaceFounderAdmin.jl:1
in expression starting at stdin:
Stacktrace:
[1] pkgerror(msg::String)
@ Pkg.Types ~/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/Types.jl:70
[2] precompile(ctx::Pkg.Types.Context, pkgs::Vector{…}; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, timing::Bool, _from_loading::Bool, kwargs::@Kwargs{…})
@ Pkg.API ~/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/API.jl:1659
[3] precompile(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::@Kwargs{_from_loading::Bool})
@ Pkg.API ~/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/API.jl:159
[4] precompile
@ ~/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/API.jl:147 [inlined]
[5] #precompile#114
@ ~/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/API.jl:146 [inlined]
[6] #invokelatest#2
@ ./essentials.jl:894 [inlined]
[7] invokelatest
@ ./essentials.jl:889 [inlined]
[8] _require(pkg::Base.PkgId, env::String)
@ Base ./loading.jl:1963
[9] __require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base ./loading.jl:1812
[10] #invoke_in_world#3
@ ./essentials.jl:926 [inlined]
[11] invoke_in_world
@ ./essentials.jl:923 [inlined]
[12] _require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base ./loading.jl:1803
[13] macro expansion
@ ./loading.jl:1790 [inlined]
[14] macro expansion
@ ./lock.jl:267 [inlined]
[15] __require(into::Module, mod::Symbol)
@ Base ./loading.jl:1753
[16] #invoke_in_world#3
@ ./essentials.jl:926 [inlined]
[17] invoke_in_world
@ ./essentials.jl:923 [inlined]
[18] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1746
Some type information was truncated. Use `show(err)` to see complete types.
Hi @JanisErdmanis,
Thanks for the error report. It looks like my reflection code is trying to parse a CodeInfo object that represents the main body of a function.
Oxygen only cares about the function signature, so I've added some checks to try to skip everything else. Clearly, this check isn't working as intended - I'll have to see why its failing in this case.
Feel free to actually open an issue for this since this will probably affect other package authors.
I've also added a new test package in this update to check for precompilation issues. Once I figure out the reason, I'll try to recreate that case inside that test package
Hi @JanisErdmanis,
I've updated the piece of code that's causing this issue and opened a PR. Can you manually test this branch and let me know if the issue still persists
PR: #192 Branch: hotfix/signature-parsing-bugifix
This fixed the error, and everything else seems to work as expected.