JuliaSmoothOptimizers / OptimizationProblems.jl

Optimization Problems for Julia
Other
88 stars 48 forks source link

Stack overflow at import #326

Closed gdalle closed 5 months ago

gdalle commented 5 months ago

Hey there! I have been trying to use OptimizationProblems and I get a weird error when I import ADNLPModels

julia> using ADNLPModels
Precompiling ADNLPModels
  6 dependencies successfully precompiled in 21 seconds. 37 already precompiled.
┌ Warning: Error requiring `ADNLPModels` from `OptimizationProblems.ADNLPProblems`
│   exception =
│    LoadError: StackOverflowError:
│    Stacktrace:
│         [1] promote_typeof(::Float64, ::Float64, ::Vararg{Any}) (repeats 2 times)
│           @ Base ./promotion.jl:373
│    --- the last 1 lines are repeated 2 more times ---
│    --- the last 2 lines are repeated 1 more time ---
│         [6] promote_typeof(::Float64, ::Int64, ::Vararg{Any})
│           @ Base ./promotion.jl:373
│    --- the last 1 lines are repeated 1 more time ---
│    --- the last 1 lines are repeated 2 more times ---
│    --- the last 2 lines are repeated 1 more time ---
│    --- the last 6 lines are repeated 1730 more times ---
│     [10392] promote_typeof(::Float64, ::Int64, ::Vararg{Any})
│           @ Base ./promotion.jl:373
│    --- the last 1 lines are repeated 1 more time ---
│    --- the last 1 lines are repeated 1 more time ---
│     [10395] hvcat(::NTuple{4199, Int64}, ::Int64, ::Vararg{Number})
│           @ Base ./abstractarray.jl:2154
│     [10396] hvcat(::NTuple{4199, Int64}, ::Int64, ::Float64, ::Vararg{Number})
│           @ SparseArrays ~/.julia/juliaup/julia-1.10.3+0.x64.linux.gnu/share/julia/stdlib/v1.10/SparseArrays/src/sparsevector.jl:1268
│     [10397] top-level scope
│           @ ~/.julia/packages/OptimizationProblems/nfPUU/data/tetra_duct12.jl:1
│     [10398] include(mod::Module, _path::String)
│           @ Base ./Base.jl:495
│     [10399] include(x::String)
│           @ OptimizationProblems.ADNLPProblems ~/.julia/packages/OptimizationProblems/nfPUU/src/ADNLPProblems/ADNLPProblems.jl:1
│     [10400] top-level scope
│           @ ~/.julia/packages/OptimizationProblems/nfPUU/src/ADNLPProblems/tetra.jl:71
│     [10401] include(mod::Module, _path::String)
│           @ Base ./Base.jl:495
│     [10402] include(x::String)
│           @ OptimizationProblems.ADNLPProblems ~/.julia/packages/OptimizationProblems/nfPUU/src/ADNLPProblems/ADNLPProblems.jl:1
│     [10403] top-level scope
│           @ ~/.julia/packages/OptimizationProblems/nfPUU/src/ADNLPProblems/ADNLPProblems.jl:15
│     [10404] eval
│           @ ./boot.jl:385 [inlined]
│     [10405] eval
│           @ ~/.julia/packages/OptimizationProblems/nfPUU/src/ADNLPProblems/ADNLPProblems.jl:1 [inlined]
│     [10406] (::OptimizationProblems.ADNLPProblems.var"#4#8")()
│           @ OptimizationProblems.ADNLPProblems ~/.julia/packages/Requires/Z8rfN/src/require.jl:101
│     [10407] macro expansion
│           @ timing.jl:395 [inlined]
│     [10408] err(f::Any, listener::Module, modname::String, file::String, line::Any)
│           @ Requires ~/.julia/packages/Requires/Z8rfN/src/require.jl:47
│     [10409] (::OptimizationProblems.ADNLPProblems.var"#3#7")()
│           @ OptimizationProblems.ADNLPProblems ~/.julia/packages/Requires/Z8rfN/src/require.jl:100
│     [10410] withpath(f::Any, path::String)
│           @ Requires ~/.julia/packages/Requires/Z8rfN/src/require.jl:37
│     [10411] (::OptimizationProblems.ADNLPProblems.var"#2#6")()
│           @ OptimizationProblems.ADNLPProblems ~/.julia/packages/Requires/Z8rfN/src/require.jl:99
│     [10412] #invokelatest#2
│           @ ./essentials.jl:892 [inlined]
│     [10413] invokelatest
│           @ ./essentials.jl:889 [inlined]
│     [10414] foreach(f::typeof(invokelatest), itr::Vector{Function})
│           @ Base ./abstractarray.jl:3097
│     [10415] loadpkg(pkg::Base.PkgId)
│           @ Requires ~/.julia/packages/Requires/Z8rfN/src/require.jl:27
│     [10416] #invokelatest#2
│           @ ./essentials.jl:892 [inlined]
│     [10417] invokelatest
│           @ ./essentials.jl:889 [inlined]
│     [10418] run_package_callbacks(modkey::Base.PkgId)
│           @ Base ./loading.jl:1169
│     [10419] __require_prelocked(uuidkey::Base.PkgId, env::String)
│           @ Base ./loading.jl:1819
│     [10420] #invoke_in_world#3
│           @ ./essentials.jl:926 [inlined]
│     [10421] invoke_in_world
│           @ ./essentials.jl:923 [inlined]
│     [10422] _require_prelocked(uuidkey::Base.PkgId, env::String)
│           @ Base ./loading.jl:1803
│     [10423] macro expansion
│           @ ./loading.jl:1790 [inlined]
│     [10424] macro expansion
│           @ ./lock.jl:267 [inlined]
│     [10425] __require(into::Module, mod::Symbol)
│           @ Base ./loading.jl:1753
│     [10426] #invoke_in_world#3
│           @ ./essentials.jl:926 [inlined]
│     [10427] invoke_in_world
│           @ ./essentials.jl:923 [inlined]
│     [10428] require(into::Module, mod::Symbol)
│           @ Base ./loading.jl:1746
│     [10429] eval
│           @ ./boot.jl:385 [inlined]
│     [10430] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
│           @ Base ./loading.jl:2076
│     [10431] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::@Kwargs{})
│           @ Base ./essentials.jl:892
│     [10432] invokelatest(::Any, ::Any, ::Vararg{Any})
│           @ Base ./essentials.jl:889
│     [10433] inlineeval(m::Module, code::String, code_line::Int64, code_column::Int64, file::String; softscope::Bool)
│           @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.79.2/scripts/packages/VSCodeServer/src/eval.jl:271
│     [10434] (::VSCodeServer.var"#69#74"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
│           @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.79.2/scripts/packages/VSCodeServer/src/eval.jl:181
│     [10435] withpath(f::VSCodeServer.var"#69#74"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams}, path::String)
│           @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.79.2/scripts/packages/VSCodeServer/src/repl.jl:276
│     [10436] (::VSCodeServer.var"#68#73"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
│           @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.79.2/scripts/packages/VSCodeServer/src/eval.jl:179
│     [10437] hideprompt(f::VSCodeServer.var"#68#73"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})
│           @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.79.2/scripts/packages/VSCodeServer/src/repl.jl:38
│     [10438] (::VSCodeServer.var"#67#72"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
│           @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.79.2/scripts/packages/VSCodeServer/src/eval.jl:150
│     [10439] with_logstate(f::Function, logstate::Any)
│           @ Base.CoreLogging ./logging.jl:515
│     [10440] with_logger
│           @ ./logging.jl:627 [inlined]
│     [10441] (::VSCodeServer.var"#66#71"{VSCodeServer.ReplRunCodeRequestParams})()
│           @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.79.2/scripts/packages/VSCodeServer/src/eval.jl:263
│     [10442] #invokelatest#2
│           @ ./essentials.jl:892 [inlined]
│     [10443] invokelatest(::Any)
│           @ Base ./essentials.jl:889
│    in expression starting at /home/gdalle/.julia/packages/OptimizationProblems/nfPUU/data/tetra_duct12.jl:1
│    in expression starting at /home/gdalle/.julia/packages/OptimizationProblems/nfPUU/src/ADNLPProblems/tetra.jl:71
└ @ Requires ~/.julia/packages/Requires/Z8rfN/src/require.jl:51
tmigot commented 5 months ago

@gdalle I cannot reproduce the error, but I have a guess. Could you check wether #327 fix your problem?

gdalle commented 5 months ago

Weirdly enough I wasn't able to reproduce it in a clean REPL when I tried

tmigot commented 5 months ago

I merged the PR that should fix I think. Let's re-open if the problem happens again then.