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

Reflection Parsing Issue #191

Closed
ndortega opened this issue Apr 29, 2024 · 0 comments · Fixed by #192
Closed

Reflection Parsing Issue #191

ndortega opened this issue Apr 29, 2024 · 0 comments · Fixed by #192
Assignees

Comments

@ndortega
Copy link
Member

ndortega commented Apr 29, 2024

It appears the issue below is occurs when the extract_defaults() function is attempting to parse a function body instead of the function signature. This check will need to be improved to ensure we only work with signatures to avoid these issues.


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.

Originally posted by @JanisErdmanis in #190 (comment)

@ndortega ndortega self-assigned this Apr 29, 2024
@ndortega ndortega linked a pull request Apr 29, 2024 that will close this issue
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