Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

100% CPU Usage in Headless Env #645

Closed
Octogonapus opened this issue Jul 10, 2020 · 2 comments
Closed

100% CPU Usage in Headless Env #645

Octogonapus opened this issue Jul 10, 2020 · 2 comments

Comments

@Octogonapus
Copy link
Contributor

Octogonapus commented Jul 10, 2020

When creating a plot in a headless environment, I observe 100% CPU usage after the plot is created. All threads stay at 100% usage indefinitely. Minimum example to reproduce:

using GLMakie, AbstractPlotting
p = scatter(1:4)

With Xvfb configuration /usr/bin/Xvfb :1 -screen 0 1024x768x24 &

This causes the CPU usage to hover around 4% on each thread instead of 100%:

using GLMakie, AbstractPlotting
GLMakie.set_window_config!(vsync=false, framerate = 1)
p = scatter(1:4)

This causes the CPU usage to stop:

using GLMakie, AbstractPlotting, FileIO
p = scatter(1:4)
GLMakie.destroy!.(p.current_screens)

It may also be worth noting that saving the plot (via FileIO.save("test.png", p)) causes the CPU usage to resume, so you'd have to destroy the screens after saving (not before, because you can't destroy the screens twice):

using GLMakie, AbstractPlotting, FileIO
p = scatter(1:4)
FileIO.save("test.png", p)
GLMakie.destroy!.(p.current_screens)

I am using Julia 1.4.2 and these versions of GLMakie and AbstractPlotting:

[[AbstractPlotting]]
deps = ["Animations", "ColorBrewer", "ColorSchemes", "ColorTypes", "Colors", "Contour", "DocStringExtensions", "FFMPEG", "FileIO", "FixedPointNumbers", "Formatting", "FreeType", "FreeTypeAbstraction", "GeometryBasics", "GridLayoutBase", "ImageIO", "IntervalSets", "LinearAlgebra", "Markdown", "Match", "Observables", "Packing", "PlotUtils", "Printf", "Random", "Serialization", "Showoff", "SignedDistanceFields", "SparseArrays", "StaticArrays", "Statistics", "StructArrays", "UnicodeFun"]
git-tree-sha1 = "6c97a57b3788d8449445abb618628a36d543fb06"
uuid = "537997a7-5e4e-5d89-9595-2241ea00577e"
version = "0.12.2"

[[GLMakie]]
deps = ["AbstractPlotting", "ColorTypes", "Colors", "FileIO", "FixedPointNumbers", "FreeTypeAbstraction", "GLFW", "GeometryBasics", "LinearAlgebra", "Markdown", "MeshIO", "ModernGL", "Observables", "Printf", "Serialization", "ShaderAbstractions", "StaticArrays"]
git-tree-sha1 = "4973ee33062bf86fa3c56e7e43c89266666a889b"
uuid = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
version = "0.1.6"

CC @ianshmean

@Octogonapus
Copy link
Contributor Author

This seems to be a deeper problem with GLFW. I tried using WaitEvents instead of PollEvents, but that seems to make xvfb (or similar) crash/hang. Ultimately, all of this can be worked around by setting the GLMakie renderloop to a noop. On a headless system, there is no point in running the renderloop anyway.

@Octogonapus
Copy link
Contributor Author

This appears to be fixed in GLMakie 0.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant