MakieOrg / Makie.jl

Interactive data visualizations and plotting in Julia
https://docs.makie.org/stable
MIT License
2.41k stars 313 forks source link

ERROR: program 20 not linked #2660

Open pbouffard opened 1 year ago

pbouffard commented 1 year ago

I've been seeing an error like this intermittently. Once it starts happening it seems like restarting Julia clears it and typically it won't happen again in the next session. I think I've usually seen it during interactive work so the conditions may not always be the same. Since it's not very reproducible thus far I have no MWE but I'll at least paste the most recent backtrace I've seen:

``` julia> for (i, row) in enumerate(eachrow(T)); lines!(t, row; label="$i"); end axislegend() di = DataInspector() ERROR: program 20 not linked. Error in: /Users/patrick/.julia/packages/GLMakie/6Blp9/assets/shader/fragment_output.frag or /Users/patrick/.julia/packages/GLMakie/6Blp9/assets/shader/util.vert or /Users/patrick/.julia/packages/GLMakie/6Blp9/assets/shader/lines.vert or /Users/patrick/.julia/packages/GLMakie/6Blp9/assets/shader/lines.geom or /Users/patrick/.julia/packages/GLMakie/6Blp9/assets/shader/lines.frag ERROR: No definition of _color in vertex shader Stacktrace: [1] error(::String, ::String, ::String, ::String) @ Base ~/.julia/dev/MuonVizTools/MakieSys-1.8-main.so:-1 [2] compile_program(shaders::Vector{GLMakie.GLAbstraction.Shader}, fragdatalocation::Vector{Tuple{Int64, String}}) @ GLMakie.GLAbstraction ~/.julia/dev/MuonVizTools/MakieSys-1.8-main.so:-1 [3] (::GLMakie.GLAbstraction.var"#65#70"{GLMakie.GLAbstraction.ShaderCache, Vector{Vector{String}}, Vector{Vector{String}}, NTuple{5, String}})() @ GLMakie.GLAbstraction ~/.julia/packages/GLMakie/6Blp9/src/GLAbstraction/GLShader.jl:261 [4] get!(default::GLMakie.GLAbstraction.var"#65#70"{GLMakie.GLAbstraction.ShaderCache, Vector{Vector{String}}, Vector{Vector{String}}, NTuple{5, String}}, h::Dict{Any, GLMakie.GLAbstraction.GLProgram}, key::Tuple{NTuple{5, String}, Vector{Vector{String}}}) @ Base ./dict.jl:481 [5] gl_convert(cache::GLMakie.GLAbstraction.ShaderCache, lazyshader::GLMakie.GLVisualizeShader, data::Dict{Symbol, Any}) @ GLMakie.GLAbstraction ~/.julia/dev/MuonVizTools/MakieSys-1.8-main.so:-1 [6] GLMakie.GLAbstraction.RenderObject(data::Dict{Symbol, Any}, program::GLMakie.GLVisualizeShader, pre::GLMakie.GLAbstraction.StandardPrerender, post::GLFW.Window, context::GLFW.Window) (repeats 2 times) @ GLMakie.GLAbstraction ~/.julia/dev/MuonVizTools/MakieSys-1.8-main.so:-1 [7] assemble_shader(data::Dict{Symbol, Any}) @ GLMakie ~/.julia/dev/MuonVizTools/MakieSys-1.8-main.so:-1 [8] draw_lines(screen::Any, position::Observable{Vector{Point{2, Float32}}}, data::Dict) @ GLMakie ~/.julia/packages/GLMakie/6Blp9/src/glshaders/lines.jl:104 [9] (::GLMakie.var"#196#197"{GLMakie.Screen{GLFW.Window}, Scene, Lines{Tuple{Vector{Point{2, Float32}}}}})(gl_attributes::Dict{Symbol, Any}) @ GLMakie ~/.julia/dev/MuonVizTools/MakieSys-1.8-main.so:-1 [10] (::GLMakie.var"#168#171"{GLMakie.var"#196#197"{GLMakie.Screen{GLFW.Window}, Scene, Lines{Tuple{Vector{Point{2, Float32}}}}}, GLMakie.Screen{GLFW.Window}, Scene, Lines{Tuple{Vector{Point{2, Float32}}}}})() @ GLMakie ~/.julia/packages/GLMakie/6Blp9/src/drawing_primitives.jl:111 [11] get!(default::GLMakie.var"#168#171"{GLMakie.var"#196#197"{GLMakie.Screen{GLFW.Window}, Scene, Lines{Tuple{Vector{Point{2, Float32}}}}}, GLMakie.Screen{GLFW.Window}, Scene, Lines{Tuple{Vector{Point{2, Float32}}}}}, h::Dict{UInt64, GLMakie.GLAbstraction.RenderObject}, key::UInt64) @ Base ./dict.jl:481 [12] cached_robj!(robj_func::GLMakie.var"#196#197"{GLMakie.Screen{GLFW.Window}, Scene, Lines{Tuple{Vector{Point{2, Float32}}}}}, screen::GLMakie.Screen{GLFW.Window}, scene::Scene, x::Lines{Tuple{Vector{Point{2, Float32}}}}) @ GLMakie ~/.julia/packages/GLMakie/6Blp9/src/drawing_primitives.jl:84 [13] draw_atomic @ ~/.julia/packages/GLMakie/6Blp9/src/drawing_primitives.jl:264 [inlined] [14] insert!(screen::GLMakie.Screen{GLFW.Window}, scene::Scene, x::Lines{Tuple{Vector{Point{2, Float32}}}}) @ GLMakie ~/.julia/packages/GLMakie/6Blp9/src/drawing_primitives.jl:126 [15] push!(scene::Scene, plot::Lines{Tuple{Vector{Point{2, Float32}}}}) @ Makie ~/.julia/dev/MuonVizTools/MakieSys-1.8-main.so:-1 [16] plot!(scene::Scene, P::Type{Lines{Tuple{Vector{Float64}, SubArray{Float32, 1, Matrix{Float32}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}}, true}}}}, attributes::Attributes, input::Tuple{Observable{Vector{Float64}}, Observable{SubArray{Float32, 1, Matrix{Float32}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}}, true}}}, args::Observable{Tuple{Vector{Point{2, Float32}}}}) @ Makie ~/.julia/packages/Makie/Za3LL/src/interfaces.jl:422 [17] plot!(::Scene, ::Type{Lines}, ::Attributes, ::Vector{Float64}, ::Vararg{Any}; kw_attributes::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ Makie ~/.julia/packages/Makie/Za3LL/src/interfaces.jl:336 [18] plot!(::Scene, ::Type{Lines}, ::Attributes, ::Vector{Float64}, ::SubArray{Float32, 1, Matrix{Float32}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}}, true}) @ Makie ~/.julia/packages/Makie/Za3LL/src/interfaces.jl:303 [19] plot!(::Axis, ::Type{Lines}, ::Attributes, ::Vector{Float64}, ::Vararg{Any}; kw_attributes::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ Makie ~/.julia/packages/Makie/Za3LL/src/makielayout/blocks/axis.jl:776 [20] plot! @ ~/.julia/packages/Makie/Za3LL/src/makielayout/blocks/axis.jl:763 [inlined] [21] #plot!#1369 @ ~/.julia/packages/Makie/Za3LL/src/makielayout/blocks/axis.jl:793 [inlined] [22] plot!(::Type{Lines}, ::Vector{Float64}, ::Vararg{Any}; kw_attributes::Base.Pairs{Symbol, String, Tuple{Symbol}, NamedTuple{(:label,), Tuple{String}}}) @ Makie ~/.julia/packages/Makie/Za3LL/src/figureplotting.jl:66 [23] lines!(::Vector{Float64}, ::Vararg{Any}; attributes::Base.Pairs{Symbol, String, Tuple{Symbol}, NamedTuple{(:label,), Tuple{String}}}) @ MakieCore ~/.julia/packages/MakieCore/bV281/src/recipes.jl:38 [24] top-level scope @ ./REPL[11]:1 [25] eval_user_input(ast::Any, backend::REPL.REPLBackend) @ REPL ~/.julia/dev/MuonVizTools/MakieSys-1.8-main.so:-1 [26] repl_backend_loop(backend::REPL.REPLBackend) @ REPL ~/.julia/dev/MuonVizTools/MakieSys-1.8-main.so:-1 [27] start_repl_backend(backend::REPL.REPLBackend, consumer::Any) @ REPL ~/.julia/dev/MuonVizTools/MakieSys-1.8-main.so:-1 [28] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool) @ REPL ~/.julia/dev/MuonVizTools/MakieSys-1.8-main.so:-1 [29] run_repl(repl::REPL.AbstractREPL, consumer::Any) @ REPL ~/.julia/dev/MuonVizTools/MakieSys-1.8-main.so:-1 [30] (::Base.var"#967#969"{Bool, Bool, Bool})(REPL::Module) @ Base ~/.julia/dev/MuonVizTools/MakieSys-1.8-main.so:-1 [31] run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_file::Bool, color_set::Bool) @ Base ~/.julia/dev/MuonVizTools/MakieSys-1.8-main.so:-1 [32] exec_options(opts::Base.JLOptions) @ Base ~/.julia/dev/MuonVizTools/MakieSys-1.8-main.so:-1 [33] _start() @ Base ~/.julia/dev/MuonVizTools/MakieSys-1.8-main.so:-1 ```

The second ERROR: line isn't always the same across different times I've seen this. The mentioned program NN tends to be low double-digit (I think 20 is the highest I've seen) and seems to be different (possibly always incrementing) when I try again in the same session.

I've seen this a handful of times before this time today; if I see it again I'll capture the output.

Julia 1.8.5 GLMakie 0.8.1 MacOS 13.2 MacBook Pro M2 Max

SimonDanisch commented 1 year ago

I can't execute your example... Can you give a working MWE?

pbouffard commented 1 year ago

@SimonDanisch I'm not sure about the "W" in this MWE, as it's only been intermittent for me, but I think this should be close to what I was doing:

using GLMakie
f = Figure(; resolution=(800,600))
ax = Axis(f[1,1]); f
display(f)
T = rand(Float32, 13, 12001)
for (i, row) in enumerate(eachrow(T)); lines!(t, row; label="$i"); end
axislegend()
di = DataInspector()

Note that those last 3 lines were pasted together, so I don't think that it was necessarily the DataInspector call that triggered the error (nor the axis legend) -- you can probably tell from my earlier traceback.

Also, earlier in the session where this happened, I had called (with no arguments) another function of mine, new3dscreen:

_FIGNUM = 1
"""Create a new Makie window with empty 3D axes and a coordinate triad at the origin"""
function new3dscreen(; perspectiveness=0.8, resolution=(1200, 900), windowtitle=nothing, title="", screen_config=Dict(), create_datainspector=true)
  f = Figure(; resolution)
  ax = Axis3(f[1, 1]; perspectiveness, aspect=:data, title=title)
  rowsize!(f.layout, 1, Relative(1))
  coordtriad!(; length=0.1)
  if isnothing(windowtitle)
    global _FIGNUM += 1
    windowtitle="Figure $_FIGNUM"
  end
  s = GLMakie.Screen(; title=windowtitle, vsync=true, focus_on_show=true, framerate=60.0, screen_config...)
  display(s, f)
  if create_datainspector
    _ = DataInspector()
  end
  s # return the Screen
end

I didn't end up doing anything with the resulting window. I don't recall but I may have closed it* before continuing with the stuff in the MWE.

pbouffard commented 11 months ago

Just wanted to report that I still see this, with Makie 0.20.0, though I still don't have a MWE unfortunately. I would say it does seem to be happening more frequently, at least right now.

Errors look similar; here's one:

ERROR: program 16 not linked. Error in:
/Users/patrick/.julia/packages/GLMakie/BFWek/assets/shader/util.vert or /Users/patrick/.julia/packages/GLMakie/BFWek/assets/shader/mesh.vert or /Users/patrick/.julia/packages/GLMakie/BFWek/assets/shader/fragment_output.frag or /Users/patrick/.julia/packages/GLMakie/BFWek/assets/shader/mesh.frag or /Users/patrick/.julia/packages/GLMakie/BFWek/assets/shader/lighting.frag
ERROR: No definition of render in vertex shader

I also just had, and I don't think I've seen this before, this message appear at the REPL - not sure exactly what I was doing at the time as it was obscured by the GLMakie windows:

UNSUPPORTED (log once): POSSIBLE ISSUE: unit 0 GLD_TEXTURE_INDEX_2D is unloadable and bound to sampler type (Float) - using zero texture because texture unloadable

I do think I'm seeing now a correlation between this error and having multiple GLMakie windows open - though it still is intermittent. Also, just now I exited Julia and on the way out got this:

error in running finalizer: GLFW.GLFWError(code=GLFW.ErrorCode(0x00010001), description="The GLFW library is not initialized")
jl_f_throw at /Users/patrick/.julia/juliaup/julia-1.9.3+0.aarch64.apple.darwin14/lib/julia/libjulia-internal.1.9.dylib (unknown line)
ijl_apply_generic at /Users/patrick/.julia/juliaup/julia-1.9.3+0.aarch64.apple.darwin14/lib/julia/libjulia-internal.1.9.dylib (unknown line)
_ErrorCallbackWrapper at /Users/patrick/.julia/packages/GLFW/BWxfF/src/callback.jl:43
jfptr__ErrorCallbackWrapper_129 at /Users/patrick/.julia/compiled/v1.9/GLFW/n8HlT_AFqiP.dylib (unknown line)
ijl_apply_generic at /Users/patrick/.julia/juliaup/julia-1.9.3+0.aarch64.apple.darwin14/lib/julia/libjulia-internal.1.9.dylib (unknown line)
jlcapi__ErrorCallbackWrapper_142 at /Users/patrick/.julia/compiled/v1.9/GLFW/n8HlT_AFqiP.dylib (unknown line)
_glfwInputError at /Users/patrick/.julia/artifacts/7f4d1479db8bfb628aff3806c483e5fec617271a/lib/libglfw.3.3.dylib (unknown line)
glfwMakeContextCurrent at /Users/patrick/.julia/artifacts/7f4d1479db8bfb628aff3806c483e5fec617271a/lib/libglfw.3.3.dylib (unknown line)
MakeContextCurrent at /Users/patrick/.julia/packages/GLFW/BWxfF/src/glfw3.jl:694 [inlined]
native_switch_context! at /Users/patrick/.julia/packages/GLMakie/BFWek/src/glwindow.jl:200 [inlined]
switch_context! at /Users/patrick/.julia/packages/ShaderAbstractions/WdAfM/src/context.jl:51
jfptr_switch_contextNOT._17013 at /Users/patrick/.julia/compiled/v1.9/GLMakie/nfnZR_c9dgm.dylib (unknown line)
ijl_apply_generic at /Users/patrick/.julia/juliaup/julia-1.9.3+0.aarch64.apple.darwin14/lib/julia/libjulia-internal.1.9.dylib (unknown line)
destroy! at /Users/patrick/.julia/packages/GLMakie/BFWek/src/screen.jl:526
unknown function (ip: 0x349dc4467)
ijl_apply_generic at /Users/patrick/.julia/juliaup/julia-1.9.3+0.aarch64.apple.darwin14/lib/julia/libjulia-internal.1.9.dylib (unknown line)
delete! at /Users/patrick/.julia/packages/GLMakie/BFWek/src/screen.jl:558
ijl_apply_generic at /Users/patrick/.julia/juliaup/julia-1.9.3+0.aarch64.apple.darwin14/lib/julia/libjulia-internal.1.9.dylib (unknown line)
delete! at /Users/patrick/.julia/packages/GLMakie/BFWek/src/screen.jl:551
ijl_apply_generic at /Users/patrick/.julia/juliaup/julia-1.9.3+0.aarch64.apple.darwin14/lib/julia/libjulia-internal.1.9.dylib (unknown line)
delete! at /Users/patrick/.julia/packages/Makie/AyuSG/src/scenes.jl:488
jfptr_deleteNOT._18784 at /Users/patrick/.julia/compiled/v1.9/Makie/iZ1Bl_c9dgm.dylib (unknown line)
ijl_apply_generic at /Users/patrick/.julia/juliaup/julia-1.9.3+0.aarch64.apple.darwin14/lib/julia/libjulia-internal.1.9.dylib (unknown line)
#empty!#189 at /Users/patrick/.julia/packages/Makie/AyuSG/src/scenes.jl:418
empty! at /Users/patrick/.julia/packages/Makie/AyuSG/src/scenes.jl:414 [inlined]
free at /Users/patrick/.julia/packages/Makie/AyuSG/src/scenes.jl:402
jfptr_free_14490 at /Users/patrick/.julia/compiled/v1.9/Makie/iZ1Bl_c9dgm.dylib (unknown line)
ijl_apply_generic at /Users/patrick/.julia/juliaup/julia-1.9.3+0.aarch64.apple.darwin14/lib/julia/libjulia-internal.1.9.dylib (unknown line)
run_finalizer at /Users/patrick/.julia/juliaup/julia-1.9.3+0.aarch64.apple.darwin14/lib/julia/libjulia-internal.1.9.dylib (unknown line)
jl_gc_run_finalizers_in_list at /Users/patrick/.julia/juliaup/julia-1.9.3+0.aarch64.apple.darwin14/lib/julia/libjulia-internal.1.9.dylib (unknown line)
run_finalizers at /Users/patrick/.julia/juliaup/julia-1.9.3+0.aarch64.apple.darwin14/lib/julia/libjulia-internal.1.9.dylib (unknown line)
ijl_atexit_hook at /Users/patrick/.julia/juliaup/julia-1.9.3+0.aarch64.apple.darwin14/lib/julia/libjulia-internal.1.9.dylib (unknown line)
jl_repl_entrypoint at /Users/patrick/.julia/juliaup/julia-1.9.3+0.aarch64.apple.darwin14/lib/julia/libjulia-internal.1.9.dylib (unknown line)

I'm wondering if somehow some global GPU resources are not being freed. I'm going to try restarting and see if it triggers as often as it is right now...

... hmm, it does still trigger pretty reliably after a restart

pbouffard commented 11 months ago

Aha! So, if I introduce a brief sleep call in between successive windows creation, with any duration (even zero), I don't get this error. That's a good enough workaround for me for now.

Edit: actually it looks like there is a sensitivity to where the sleep happens. If I place it after the creation of the window but before anything has been plotted, the error (though slightly different, in this case I'm seeing program 19 and ERROR: No definition of write2framebuffer in fragment shader ).

ffreyer commented 2 months ago

Might be that GLMakie tries to reuse a screen that hasn't been cleaned up completely yet due to the async renderloop.