Makie.jl icon indicating copy to clipboard operation
Makie.jl copied to clipboard

GLMakie does not recover from user interrupt

Open lassepe opened this issue 2 years ago • 3 comments
trafficstars

On Makie master (and since at least Makie 0.18), interrupting a plot with CTRL + C sometimes leads to the following kind of error:

^CUnhandled Task ERROR: InterruptException:
Stacktrace:
 [1] lookup(pointer::Ptr{Nothing})
   @ Base.StackTraces ./stacktraces.jl:189
 [2] process_backtrace(t::Vector{Union{Ptr{Nothing}, Base.InterpreterIP}}, limit::Int64; skipC::Bool)
   @ Base ./errorshow.jl:920
 [3] process_backtrace
   @ Distributed ./errorshow.jl:910 [inlined]
 [4] CapturedException
   @ Distributed ./task.jl:17 [inlined]
 [5] run_work_thunk(thunk::Distributed.var"#153#154"{typeof(Core.eval), Tuple{Module, Expr}, @Kwargs{}}, print_error::Bool)
   @ Distributed ~/.julia/juliaup/julia-1.10.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.10/Distributed/src/process_messages.jl:72
 [6] run_work_thunk(rv::Distributed.RemoteValue, thunk::Function)
   @ Distributed ~/.julia/juliaup/julia-1.10.0-beta1+0.x64.linux.gnu/share/jul
ia/stdlib/v1.10/Distributed/src/process_messages.jl:79
 [7] (::Distributed.var"#100#102"{Distributed.RemoteValue, Distributed.var"#153#154"{…}})()
   @ Distributed ~/.julia/juliaup/julia-1.10.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.10/Distributed/src/process_messages.jl:88
Some type information was truncated. Use `show(err)` to see complete types.

caused by: UndefVarError: `delete_method_by_sig` not defined
Click to expand stacktrace
Stacktrace:
 [1] top-level scope
   @ none:1
ERROR: ArgumentError: Package GLMakie not found in current path.
- Run `import Pkg; Pkg.add("GLMakie")` to install the GLMakie package.
Stacktrace:
 [1] macro expansion
   @ Base ./loading.jl:1766 [inlined]
 [2] macro expansion
   @ Base ./lock.jl:267 [inlined]
 [3] __require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1747
 [4] #invoke_in_world#3
   @ Base ./essentials.jl:921 [inlined]
 [5] invoke_in_world
   @ Base ./essentials.jl:918 [inlined]
 [6] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1740
 [7] top-level scope
   @ ~/.julia/packages/Infiltrator/LtFao/src/Infiltrator.jl:726

Afterwards, I can no longer get GLMakie to plot anything in the same session; even if I issue GLMakie.activate!() again.

Here is what I see after trying to plot again after the error above

julia> scatter(rand(100))
Error showing value of type Makie.FigureAxisPlot:
ERROR: TaskFailedException
Click to expand stacktrace
Stacktrace:
  [1] wait
    @ Base ./task.jl:352 [inlined]
  [2] wait(x::GLMakie.Screen{GLFW.Window})
    @ GLMakie ~/.julia/packages/GLMakie/OVxAi/src/screen.jl:425
  [3] #stop_renderloop!#71
    @ GLMakie ~/.julia/packages/GLMakie/OVxAi/src/screen.jl:802 [inlined]
  [4] stop_renderloop!
    @ GLMakie ~/.julia/packages/GLMakie/OVxAi/src/screen.jl:792 [inlined]
  [5] close(screen::GLMakie.Screen{GLFW.Window}; reuse::Bool)
    @ GLMakie ~/.julia/packages/GLMakie/OVxAi/src/screen.jl:592
  [6] singleton_screen(debugging::Bool)
    @ GLMakie ~/.julia/packages/GLMakie/OVxAi/src/screen.jl:300
  [7] GLMakie.Screen(scene::Scene, config::GLMakie.ScreenConfig; visible::Nothing, start_renderloop::Bool)
    @ GLMakie ~/.julia/packages/GLMakie/OVxAi/src/screen.jl:394
  [8] GLMakie.Screen(scene::Scene, config::GLMakie.ScreenConfig)
    @ GLMakie ~/.julia/packages/GLMakie/OVxAi/src/screen.jl:393
  [9] getscreen(::Module, ::Scene; screen_config::@Kwargs{})
    @ Makie ~/.julia/packages/Makie/iECbF/src/display.jl:400
 [10] getscreen
    @ Makie ~/.julia/packages/Makie/iECbF/src/display.jl:383 [inlined]
 [11] display(figlike::Makie.FigureAxisPlot; backend::Module, update::Bool, screen_config::@Kwargs{})
    @ Makie ~/.julia/packages/Makie/iECbF/src/display.jl:160
 [12] display(figlike::Makie.FigureAxisPlot)
    @ Makie ~/.julia/packages/Makie/iECbF/src/display.jl:131
 [13] #invokelatest#2
    @ Base ./essentials.jl:887 [inlined]
 [14] invokelatest
    @ Base ./essentials.jl:884 [inlined]
 [15] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{…})
    @ REPL ~/.julia/juliaup/julia-1.10.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.10/REPL/src/REPL.jl:302
 [16] (::REPL.var"#57#58"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL ~/.julia/juliaup/julia-1.10.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.10/REPL/src/REPL.jl:284
 [17] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL ~/.julia/juliaup/julia-1.10.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.10/REPL/src/REPL.jl:554
 [18] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL ~/.julia/juliaup/julia-1.10.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.10/REPL/src/REPL.jl:282
 [19] (::REPL.var"#do_respond#80"{…})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL ~/.julia/juliaup/julia-1.10.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.10/REPL/src/REPL.jl:896
 [20] #invokelatest#2
    @ Base ./essentials.jl:887 [inlined]
 [21] invokelatest
    @ Base ./essentials.jl:884 [inlined]
 [22] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit ~/.julia/juliaup/julia-1.10.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.10/REPL/src/LineEdit.jl:2656
 [23] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL ~/.julia/juliaup/julia-1.10.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.10/REPL/src/REPL.jl:1297
 [24] (::REPL.var"#62#68"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ~/.julia/juliaup/julia-1.10.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.10/REPL/src/REPL.jl:373
Some type information was truncated. Use `show(err)` to see complete types.

    nested task error: InterruptException:
    Stacktrace:
      [1] poptask(W::Base.IntrusiveLinkedListSynchronized{Task})
        @ Base ./task.jl:985
      [2] wait()
        @ Base ./task.jl:994
      [3] wait(c::Base.GenericCondition{Base.Threads.SpinLock}; first::Bool)
        @ Base ./condition.jl:130
      [4] wait
        @ Base ./condition.jl:125 [inlined]
      [5] _trywait(t::Timer)
        @ Base ./asyncevent.jl:138
      [6] wait
        @ Base ./asyncevent.jl:155 [inlined]
      [7] sleep(sec::Float64)
        @ Base ./asyncevent.jl:240
      [8] on_demand_renderloop(screen::GLMakie.Screen{GLFW.Window})
        @ GLMakie ~/.julia/packages/GLMakie/OVxAi/src/screen.jl:881
      [9] renderloop(screen::GLMakie.Screen{GLFW.Window})
        @ GLMakie ~/.julia/packages/GLMakie/OVxAi/src/screen.jl:897
     [10] (::GLMakie.var"#69#70"{GLMakie.Screen{GLFW.Window}})()
        @ GLMakie ~/.julia/packages/GLMakie/OVxAi/src/screen.jl:776

Thoughts/Questions

  • Ideally, GLMakie should try to clean up the state automatically in such a situation
  • If an automatic cleanup is not possible, is there a reset function that I can call to save my REPL?

lassepe avatar Aug 01 '23 10:08 lassepe

Bumping this. Ran into it today.

pdeffebach avatar Jan 04 '24 19:01 pdeffebach

I'm not sure if there's anything we can do on the Makie side....

SimonDanisch avatar Jan 04 '24 20:01 SimonDanisch

the interrupt stops the rendertask, when it happens, i do:

GLMakie.SINGLETON_SCREEN[1].rendertask = nothing

is there any reason why stop_renderloop! or wait(screen) dont handle stopped tasks?

ghost avatar May 19 '24 13:05 ghost

Closing as duplicate of #2461.

ffreyer avatar Aug 26 '24 12:08 ffreyer