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

Precompilation segfault on WSL2 with GLMakie 0.10.6

Open timholy opened this issue 1 year ago • 12 comments

  • [X] what version of Makie are you running? (]st -m Makie)
  [e9467ef8] GLMakie v0.10.6
  [ee78f7c6] Makie v0.21.6
  • [X] can you reproduce the bug with a fresh environment ? (]activate --temp; add Makie) Yes

  • [X] What platform + GPU are you on? Windows running WSL2 (on the Linux side) with Ubuntu 20.04, Intel Iris Xe Graphics.

pkg> activate --temp
(jl_knUBOc) pkg> add Makie GLMakie
 ⋮
Precompiling project...
  ✗ GLMakie
  2 dependencies successfully precompiled in 105 seconds. 232 already precompiled.
  1 dependency errored.
  For a report of the errors see `julia> err`. To retry use `pkg> precompile`

julia> using GLMakie
Precompiling GLMakie
        Info Given GLMakie was explicitly requested, output will be shown live

[2007] signal (11.1): Segmentation fault
in expression starting at /home/tim/.julia/packages/Makie/GWb7z/precompile/shared-precompile.jl:4
unknown function (ip: 0x7f6cb5bfb2ec)
unknown function (ip: (nil))
Allocations: 39480059 (Pool: 39455302; Big: 24757); GC: 59

However, GLMakie v0.10.5 works fine.

timholy avatar Aug 19 '24 09:08 timholy

There are a couple of issues like this, and I think all of them have been solved by updating windows, wsl2 and ubuntu drivers + software.

SimonDanisch avatar Aug 19 '24 09:08 SimonDanisch

Feel free to close if you wish. Or I can try in a while to update and see if it fixes it.

timholy avatar Aug 19 '24 10:08 timholy

Feel free to wait until you updated everything ;) There's always a chance this is a new thing, although, I doubt there's much we can do about it from experience. I think a good sanity check is:

using GLFW
GLFW.Window()

If that segfaults, it must be some WSL2/driver issue!

SimonDanisch avatar Aug 19 '24 10:08 SimonDanisch

It happened with GLMakie 0.10.6 but not 0.10.5. Were they using different GLFW versions?

timholy avatar Aug 19 '24 16:08 timholy

Hm, that'd be unexpected... So the pure GLFW version works?

SimonDanisch avatar Aug 19 '24 17:08 SimonDanisch

Feel free to wait until you updated everything ;) There's always a chance this is a new thing, although, I doubt there's much we can do about it from experience. I think a good sanity check is:

using GLFW
GLFW.Window()

If that segfaults, it must be some WSL2/driver issue!

Encountering the same issue as the OP.

Ran, as suggested,

using GLFW
GLFW.Window()

A GLWindow (Ubuntu) window opened with

GLFW.Window(Ptr{Nothing} @0x0000000002600f70)

returned on the Julia REPL line.

WSL2 on Windows 11:

Ubuntu version: 22.04.4 LTS

WSL version: 2.2.4.0 Kernel version: 5.15.153.1-2 WSLg version: 1.0.61 MSRDC version: 1.2.5326 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.26091.1-240325-1447.ge-release Windows version: 10.0.22635.4076

Julia version: 1.10.4

Makie version: 0.21.7 GLMakie version: 0.10.7 GLFW version: 3.4.3

Nvidia GeForce driver version: 560.81

GLMakie version 0.10.5 and previous versions all worked as they should.

On my system, as listed above, the full error report:

Precompiling GLMakie
        Info Given GLMakie was explicitly requested, output will be shown live 

[15005] signal (11.1): Segmentation fault
in expression starting at /home/audrius/.julia/packages/Makie/aG6xp/precompile/shared-precompile.jl:4
unknown function (ip: 0x7f3925bc2a52)
unknown function (ip: 0x8114217)
Allocations: 39260971 (Pool: 39236462; Big: 24509); GC: 57
  ✗ GLMakie
  0 dependencies successfully precompiled in 23 seconds. 252 already precompiled.

ERROR: LoadError: The following 1 direct dependency failed to precompile:

GLMakie [e9467ef8-e4e7-5192-8a1a-b1aee30e663a]

Failed to precompile GLMakie [e9467ef8-e4e7-5192-8a1a-b1aee30e663a] to "/home/audrius/.julia/compiled/v1.10/GLMakie/jl_TajsSA".
[15005] signal (11.1): Segmentation fault
in expression starting at /home/audrius/.julia/packages/Makie/aG6xp/precompile/shared-precompile.jl:4
unknown function (ip: 0x7f3925bc2a52)
unknown function (ip: 0x8114217)
Allocations: 39260971 (Pool: 39236462; Big: 24509); GC: 5
Stacktrace:
  [1] pkgerror(msg::String)
    @ Pkg.Types ~/julia-1.10.4/share/julia/stdlib/v1.10/Pkg/src/Types.jl:70
  [2] precompile(ctx::Pkg.Types.Context, pkgs::Vector{…}; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, timing::Bool, _from_loading::Bool, kwargs::@Kwargs{…})
    @ Pkg.API ~/julia-1.10.4/share/julia/stdlib/v1.10/Pkg/src/API.jl:1659
  [3] precompile(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::@Kwargs{_from_loading::Bool})
    @ Pkg.API ~/julia-1.10.4/share/julia/stdlib/v1.10/Pkg/src/API.jl:159
  [4] precompile
    @ ~/julia-1.10.4/share/julia/stdlib/v1.10/Pkg/src/API.jl:147 [inlined]
  [5] #precompile#114
    @ ~/julia-1.10.4/share/julia/stdlib/v1.10/Pkg/src/API.jl:146 [inlined]
  [6] #invokelatest#2
    @ ./essentials.jl:894 [inlined]
  [7] invokelatest
    @ ./essentials.jl:889 [inlined]
  [8] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:1963
  [9] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1812
 [10] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [11] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [12] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1803
 [13] macro expansion
    @ ./loading.jl:1790 [inlined]
 [14] macro expansion
    @ ./lock.jl:267 [inlined]
 [15] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1753
 [16] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [17] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [18] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1746
 [19] include(fname::String)
    @ Base.MainInclude ./client.jl:489
 [20] top-level scope
    @ REPL[1]:1

Audrius-St avatar Aug 21 '24 08:08 Audrius-St

Encountering the same issue as the OP.

Me too.

I have one environment pinned at GLMakie v0.10.5 which is behaving as expected, and one updated to GLMakie v0.10.7 which segfaults. I.e. Makie v0.21.7 and GLMakie v0.10.7 segfaults, while Makie v0.21.5 and GLMakie v0.10.5 works.

WSL version: 2.1.5.0 Kernel version: 5.15.146.1-2 WSLg version: 1.0.60 MSRDC version: 1.2.5105 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.19045.4529

Ubuntu 24.04 LTS

Julia Version 1.10.4

Using latest mesa drivers from Kisak-mesa PPA.

GLFW.Window() works in both environments with GLFW v3.4.3

highflyer737 avatar Aug 21 '24 15:08 highflyer737

This issue persists in the new GLMakie release v0.10.9.

Audrius-St avatar Aug 27 '24 17:08 Audrius-St

I just tried it myself:

s = Scene()
display(s) # works
scatter!(s, 1:4) # segfaults

@ffreyer , from the diff, it looks like it's related to clip plane introduced in [email protected]

SimonDanisch avatar Aug 27 '24 17:08 SimonDanisch

I just tried it myself:

s = Scene()
display(s) # works
scatter!(s, 1:4) # segfaults

@ffreyer , from the diff, it looks like it's related to clip plane introduced in [email protected]

Thanks for checking and identifying the potential source of the bug.

Audrius-St avatar Aug 27 '24 17:08 Audrius-St

I just tried it myself:

s = Scene()
display(s) # works
scatter!(s, 1:4) # segfaults

@ffreyer , from the diff, it looks like it's related to clip plane introduced in [email protected]

In terms of OpenGL function calls, that pr only added

N = to_value(get(robj.uniforms, :num_clip_planes, 0))
for i in 0:min(7, N-1)
    glEnable(GL_CLIP_DISTANCE0 + UInt32(i))
end

which doesn't even run without defining clip planes.

ffreyer avatar Aug 27 '24 18:08 ffreyer

Hm, I think it's the GPU drivers glsl compiler segfaulting on the clip plane code -.- I removed the clipplane code from util.vert and sprites.geom and it works without segfault. No idea why the WSL2 drivers like to segfault so much.

SimonDanisch avatar Aug 27 '24 18:08 SimonDanisch

FWIW, I just tried to compile GLMakie v0.10.10 on WSL2 and faced the above-noted segfault on precompile: downgrading to v0.10.5 resolved the issue though.

thchr avatar Sep 13 '24 08:09 thchr

 [3f19e933] + p7zip_jll v17.4.0+2
        Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`
Precompiling project...
  ✗ GLMakie
  123 dependencies successfully precompiled in 120 seconds. 147 already precompiled.
  1 dependency had output during precompilation:
└
  1 dependency errored.
  For a report of the errors see `julia> err`. To retry use `pkg> precompile`

(@v1.11) pkg> add GLMakie
   Resolving package versions...
  No Changes to `~/.julia/environments/v1.11/Project.toml`
  No Changes to `~/.julia/environments/v1.11/Manifest.toml`
Precompiling project...
  1 dependency successfully precompiled in 33 seconds. 270 already precompiled.

(@v1.11) pkg> st GLMakie
Status `~/.julia/environments/v1.11/Project.toml`
  [e9467ef8] GLMakie v0.10.10

julia> using GLMakie

julia> scatter(1:4)

For some reason it worked for me after adding GLMakie two times? But then it works now on WSL2 for me. Not sure what's going on here.

SimonDanisch avatar Sep 13 '24 08:09 SimonDanisch

The update GLMakie v0.10.10 precompiled on my system without reporting any errors and passed the

julia> using GLMakie

julia> scatter(1:10)

test.

Julia version 1.10.5

WSL version: 2.2.4.0 Kernel version: 5.15.153.1-2 WSLg version: 1.0.61 MSRDC version: 1.2.5326 Windows version: 10.0.22635.4145

Ubuntu 22.04.5 LTS OpenGL core profile version string: 4.6 (Core Profile) Mesa 24.2.2 - kisak-mesa PPA

Thank you for your and your colleagues work in addressing this gl_ClipDistance in geometry shader issue.

Audrius-St avatar Sep 13 '24 19:09 Audrius-St

I still see this on GLMakie v0.10.14:

Precompiling project...
  ✗ GLMakie
  0 dependencies successfully precompiled in 37 seconds. 418 already precompiled.
  1 dependency errored.
  For a report of the errors see `julia> err`. To retry use `pkg> precompile`

julia> err
PkgPrecompileError: The following 1 direct dependency failed to precompile:

GLMakie [e9467ef8-e4e7-5192-8a1a-b1aee30e663a]

Failed to precompile GLMakie [e9467ef8-e4e7-5192-8a1a-b1aee30e663a] to "/home/tchr/.julia/compiled/v1.10/GLMakie/jl_6HU8CW".
[32737] signal (11.1): Segmentation fault
in expression starting at /home/tchr/.julia/packages/Makie/6c4lt/precompile/shared-precompile.jl:4
unknown function (ip: 0x7f007b2f42ec)
unknown function (ip: (nil))
Allocations: 39085044 (Pool: 39060508; Big: 24536); GC: 5

On:

julia> versioninfo()
Julia Version 1.10.5
Commit 6f3fdf7b362 (2024-08-27 14:19 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, tigerlake)
Threads: 8 default, 0 interactive, 4 GC (on 8 virtual cores)
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 8
  JULIA_PKG_PRESERVE_TIERED_INSTALLED  = true

thchr avatar Oct 25 '24 12:10 thchr