colormap("<Color>", maxcount; w=<Int>, logscale=<Bool>) stackoverflows
Closed this issue · 7 comments
Previously was working now produces
ERROR: StackOverflowError:
Stacktrace:
[1] colormap(cname::String, args::Int32; kwargs::Base.Pairs{Symbol, Real, Tuple{Symbol, Symbol}, NamedTuple{(:w, :logscale), Tuple{Float64, Bool}}}) (repeats 25917 times)
@ Colors ~/.julia/packages/Colors/mIuXl/src/colormaps.jl:326
[2] eval
@ ./boot.jl:368 [inlined]
[3] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base ./loading.jl:1428
[4] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Base ./essentials.jl:729
[5] invokelatest(::Any, ::Any, ::Vararg{Any})
@ Base ./essentials.jl:726
[6] inlineeval(m::Module, code::String, code_line::Int64, code_column::Int64, file::String; softscope::Bool)
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.38.2/scripts/packages/VSCodeServer/src/eval.jl:233
[7] (::VSCodeServer.var"#66#70"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.38.2/scripts/packages/VSCodeServer/src/eval.jl:157
[8] withpath(f::VSCodeServer.var"#66#70"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams}, path::String)
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.38.2/scripts/packages/VSCodeServer/src/repl.jl:249
[9] (::VSCodeServer.var"#65#69"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.38.2/scripts/packages/VSCodeServer/src/eval.jl:155
[10] hideprompt(f::VSCodeServer.var"#65#69"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.38.2/scripts/packages/VSCodeServer/src/repl.jl:38
[11] (::VSCodeServer.var"#64#68"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.38.2/scripts/packages/VSCodeServer/src/eval.jl:126
[12] with_logstate(f::Function, logstate::Any)
@ Base.CoreLogging ./logging.jl:511
[13] with_logger
@ ./logging.jl:623 [inlined]
[14] (::VSCodeServer.var"#63#67"{VSCodeServer.ReplRunCodeRequestParams})()
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.38.2/scripts/packages/VSCodeServer/src/eval.jl:225
[15] #invokelatest#2
@ ./essentials.jl:729 [inlined]
[16] invokelatest(::Any)
@ Base ./essentials.jl:726
[17] macro expansion
@ ~/.vscode/extensions/julialang.language-julia-1.38.2/scripts/packages/VSCodeServer/src/eval.jl:34 [inlined]
[18] (::VSCodeServer.var"#61#62")()
@ VSCodeServer ./task.jl:484
versioninfo
Commit 00177ebc4fc (2022-12-23 21:32 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin21.4.0)
CPU: 12 × Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
Threads: 12 on 6 virtual cores
Environment:
JULIA_EDITOR = code
JULIA_NUM_THREADS = 12
What was working? You didn't post the command that triggered the error.
Oh I see, it's essentially the title. But
julia> colormap("Blues", 5; w=7, logscale=false)
5-element Array{RGB{Float64},1} with eltype RGB{Float64}:
RGB{Float64}(1.0,0.9689444400515476,0.8339613400131303)
RGB{Float64}(0.7002333050365439,0.9232888688313844,0.5721953036991152)
RGB{Float64}(0.0,0.8116721169252812,0.7458361582969534)
RGB{Float64}(0.0,0.5087434882664857,0.7762718761091344)
RGB{Float64}(0.019190711289394265,0.15713212232170762,0.3484547991055406)
If you can post a reproducible example that would be a big help.
Hello Tim (hats off to you). I'm trying to define the color bar for a heatmap/choropleth based on some count and had recorded a maxcount
of 150 and I guess that blew the stack.
If you know the args that triggered this is seems to merit investigation. colormap("Blues", 150; w=7, logscale=false)
also works for me. (maxcount=150
does not sound excessive.)
Also, which version of Colors are you using? Line 326 does not contain a recursive call in the current master
branch:
Line 326 in f0a508b
I am running Colors v0.12.10
which Pkg
does not tag for possible update or that it is being held back.
It is somewhat strange; when I run the command on a fresh session I cannot blow it up -VSCode just gives up on displaying the palette but it is still there (>20_000). But on my development context I get the overflow with just 150.
The exact command is run-of-the-mill colmap = colormap("Reds", maxcount; w=7, logscale = true)
where maxcount = 150
. I'm using Makie
for plotting of an animated choropleth and have on volatile very many data points but no processes running that would hijack the stack, to the best of my knowledge.
Please let me know what else I can do.
Thanks very much for the concrete call. It still doesn't replicate for me BUT I think I figured it out based on the fact that your version is
Line 326 in da0045a
julia> colormap("Reds", 3; w=7, logscale = true)
3-element Array{RGB{Float64},1} with eltype RGB{Float64}:
RGB{Float64}(0.9582804535342538,0.958741006843247,0.9347144456966647)
RGB{Float64}(0.8905762771702996,0.9198617509685533,0.9659542256449846)
RGB{Float64}(0.42599527176569785,0.04573322950982179,0.03379128459010661)
julia> colormap("Reds", Int32(3); w=7, logscale = true)
ERROR: StackOverflowError:
Stacktrace:
[1] colormap(cname::String, args::Int32; kwargs::Base.Pairs{Symbol, Integer, Tuple{Symbol, Symbol}, NamedTuple{(:w, :logscale), Tuple{Int64, Bool}}}) (repeats 39992 times)
@ Colors ~/.julia/packages/Colors/mIuXl/src/colormaps.jl:326
The problem comes from specifying N
as an Integer that is not Int
: that line is supposed to dispatch to
Line 284 in da0045a
N
isn't an Int
.
That should let you work around it, but this is something we should fix. It already looks fixed on master
so maybe we should just focus on getting that out.
Got it. Thanks!