2

I am experiencing slightly strange behaviour from a visualisation routine I have written using Plots.jl. The module I have written uses code of the following form (with some irrelevant details removed). It is intended to produce a 2D animation of the results of a 2D partial differential equation.

anim = @animate for (i,u) in enumerate(sol.u)
    heatmap(u)
end
gif(anim,"output/anim_u.gif",fps=5)

If I run my program with this code at the end, the program hangs indefinitely after opening a "gksqt" application in the dock. Killing the program produces the following stacktrace.

Stacktrace:
  [1] poptask(W::Base.InvasiveLinkedListSynchronized{Task})
    @ Base ./task.jl:760
  [2] wait
    @ ./task.jl:768 [inlined]
  [3] wait(c::Base.GenericCondition{Base.Threads.SpinLock})
    @ Base ./condition.jl:106
  [4] wait(x::Base.Process)
    @ Base ./process.jl:621
  [5] success
    @ ./process.jl:483 [inlined]
  [6] run(::Cmd; wait::Bool)
    @ Base ./process.jl:440
  [7] run
    @ ./process.jl:438 [inlined]
  [8] (::FFMPEG.var"#4#6"{Cmd})(command_path::String)
    @ FFMPEG ~/.julia/packages/FFMPEG/OUpap/src/FFMPEG.jl:112
  [9] (::JLLWrappers.var"#2#3"{FFMPEG.var"#4#6"{Cmd}, String})()
    @ JLLWrappers ~/.julia/packages/JLLWrappers/bkwIo/src/runtime.jl:49
 [10] withenv(::JLLWrappers.var"#2#3"{FFMPEG.var"#4#6"{Cmd}, String}, ::Pair{String, String}, ::Vararg{Pair{String, String}, N} where N)
    @ Base ./env.jl:161
 [11] withenv_executable_wrapper(f::Function, executable_path::String, PATH::String, LIBPATH::String, adjust_PATH::Bool, adjust_LIBPATH::Bool)
    @ JLLWrappers ~/.julia/packages/JLLWrappers/bkwIo/src/runtime.jl:48
 [12] #invokelatest#2
    @ ./essentials.jl:708 [inlined]
 [13] invokelatest
    @ ./essentials.jl:706 [inlined]
 [14] #ffmpeg#7
    @ ~/.julia/packages/JLLWrappers/bkwIo/src/products/executable_generators.jl:7 [inlined]
 [15] ffmpeg
    @ ~/.julia/packages/JLLWrappers/bkwIo/src/products/executable_generators.jl:7 [inlined]
 [16] #exe#2
    @ ~/.julia/packages/FFMPEG/OUpap/src/FFMPEG.jl:111 [inlined]
 [17] ffmpeg_exe
    @ ~/.julia/packages/FFMPEG/OUpap/src/FFMPEG.jl:123 [inlined]
 [18] buildanimation(anim::Plots.Animation, fn::String, is_animated_gif::Bool; fps::Int64, loop::Int64, variable_palette::Bool, verbose::Bool, show_msg::Bool)
    @ Plots ~/.julia/packages/Plots/S2aH5/src/animation.jl:96

I am completely baffled by this behaviour - if anyone has any suggestions it would be greatly appreciated.

Running on MacOS 11.2.3 with Julia 1.6.2.

crevell
  • 449
  • 6
  • 19
  • I believe `/var/folders/.......` is one of the places temporary files are stored. Strange that is failing -- if this persists, it could be worth an issue on Plots.jl or perhaps the package of whichever backend you are using. – cbk Jul 21 '21 at 20:20
  • What happens if you put `ENV["GKSwstype"]="nul" ` just after `using Plots` line? – Przemyslaw Szufel Jul 21 '21 at 23:04
  • Bizarrely, adding `ENV["GKSwstype"]="nul"` works when running the animation loop from the REPL, but the code still stalls when run in my program as a whole. Adding a print statement indicates that the loop is completed and all heatmaps are plotted, but the code hangs indefinitely when calling the `gif()` function. – crevell Jul 22 '21 at 11:15
  • I think I might be running into this issue https://github.com/JuliaPlots/Plots.jl/issues/3583 The "no such file or directory" error appears to be from an attempt to change the backend to pyplot to see if that made any difference – crevell Jul 22 '21 at 13:54
  • Extensive discussion of this issue here https://github.com/JuliaPlots/Plots.jl/issues/3664 – crevell Jul 27 '21 at 14:17

0 Answers0