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

GLMakie segmentation fault #4373

Open
3 tasks done
chriswaudby opened this issue Sep 17, 2024 · 13 comments
Open
3 tasks done

GLMakie segmentation fault #4373

chriswaudby opened this issue Sep 17, 2024 · 13 comments
Labels
bug GLMakie This relates to GLMakie.jl, the OpenGL backend for Makie. Integration with other packages needs more info

Comments

@chriswaudby
Copy link

  • what version of Makie are you running? GLMakie v0.10.11; Julia 1.10.5.
  • can you reproduce the bug with a fresh environment ? yes
  • What platform + GPU are you on? MacBook Air (13-inch, M3, 2024)

I'm creating a data analysis package using GLMakie. I have a toggle switch to turn on data fitting. This normally works fine. However, if I resize the figure window before pressing the switch, I get a segmentation fault:

[67224] signal (11.2): Segmentation fault: 11
in expression starting at none:0
gleRunVertexSubmitImmediate at /System/Library/Frameworks/OpenGL.framework/Versions/A/Resources/GLEngine.bundle/GLEngine (unknown line)
Allocations: 52378689 (Pool: 52327128; Big: 51561); GC: 57
[1]    67224 segmentation fault  Julia

No other error messages are displayed. I'm unsure how to even begin to debug this - any advice would be welcome.

@EdsterG
Copy link
Contributor

EdsterG commented Sep 18, 2024

Would you please post a MWE?

@jebej
Copy link

jebej commented Sep 26, 2024

I have also been getting segfaults when interacting/zooming with figures with GLMakie on my M1 MacBook pro. This doesn't happen on Windows. Not much of a MWE, just plot something (maybe it happens more regularly with heatmaps?), interact a bunch with it, and it ends up crashing.

@chriswaudby
Copy link
Author

I don't really have a MWE - it's an app I've been building up to view some datasets that are currently private. I'm working to get it towards a workable state along with example data but in the meantime if there's any advice on how to diagnose the problem I'm happy to take a look locally.

@ffreyer ffreyer added GLMakie This relates to GLMakie.jl, the OpenGL backend for Makie. Integration with other packages needs more info labels Sep 30, 2024
@chriswaudby
Copy link
Author

Hi,

I've now released a version of the package - which is still giving problems with segmentation faults. The package is NMRAnalysis (v0.2.0). The interface needs some data to run, I've uploaded a small dataset here:

https://github.com/chriswaudby/NMRAnalysis-bug-data/blob/main/data.tgz

This contains a single directory, 21. The MWE is then (run from the directory containing the test data):

using NMRAnalysis
hetnoe2d(["21/pdata/231","21/pdata/232"],[false,true])

On my system (M3 MacBook), I occasionally get a segfault when the window opens, or upon my first interaction with it - clicking a button, pressing a key, or trying to resize the window. On my student's computer (M1 MacBook) there's a segfault 100% of the time immediately. On a linux cluster, I don't seem to have any issues.

My versioninfo:

Julia Version 1.11.3
Commit d63adeda50d (2025-01-21 19:42 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 8 × Apple M3
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, apple-m2)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)
(@v1.11) pkg> st
Status `~/.julia/environments/v1.11/Project.toml`
  [13f3f980] CairoMakie v0.13.1
  [e9467ef8] GLMakie v0.11.2
  [2fda8390] LsqFit v0.15.0
  [eff96d63] Measurements v2.12.0
  [2774e3e8] NLsolve v4.5.1
  [e8f11e50] NMRAnalysis v0.2.0
  [e6af4f88] NMRScreen v0.0.4
  [c2839fe3] NMRTools v0.1.11
  [14b8a8f1] PkgTemplates v0.7.53
  [91a5bcdd] Plots v1.40.9
  [295af30f] Revise v3.7.2

@SimonDanisch
Copy link
Member

Is it the same as: #4771 (comment) ?
Did this start happening at some point and was working fine before?

@chriswaudby
Copy link
Author

chriswaudby commented Feb 12, 2025 via email

@SimonDanisch
Copy link
Member

Hm, maybe it's related and just doesn't lead to a segfault as often on your system.
I think we found a fix for #4771, so maybe you can try that once it's online and see if that fixes it.

@chriswaudby
Copy link
Author

chriswaudby commented Feb 12, 2025 via email

@SimonDanisch
Copy link
Member

PR is up: #4782

@chriswaudby
Copy link
Author

I've just run Julia through lldb and attaching a backtrace below - maybe this is helpful?

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x00000001e8be963c GLEngine`gleRunVertexSubmitImmediate + 3424
GLEngine`gleRunVertexSubmitImmediate:
->  0x1e8be963c <+3424>: ldr    s0, [x9]
    0x1e8be9640 <+3428>: str    s0, [sp, #0xc0]
    0x1e8be9644 <+3432>: b      0x1e8be964c    ; <+3440>
    0x1e8be9648 <+3436>: mov    w24, #0x0 ; =0 
Target 0: (julia) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x00000001e8be963c GLEngine`gleRunVertexSubmitImmediate + 3424
    frame #1: 0x00000001e8b83a68 GLEngine`gleDrawArraysOrElements_ExecCore + 624
    frame #2: 0x00000001e8b7d894 GLEngine`glDrawElements_GL3Exec + 412
    frame #3: 0x0000000337214bd4 nfnZR_8pCiU.dylib`julia_render_59077 at functionloading.jl:73
    frame #4: 0x00000003373432b0 nfnZR_8pCiU.dylib`jfptr_render_59078 + 64
    frame #5: 0x0000000337263520 nfnZR_8pCiU.dylib`julia_StandardPostrender_63972 at GLRenderObject.jl:68
    frame #6: 0x0000000337391650 nfnZR_8pCiU.dylib`jfptr_StandardPostrender_63973 + 52
    frame #7: 0x00000003372fdaa0 nfnZR_8pCiU.dylib`julia_render_59046 at GLRender.jl:93
    frame #8: 0x00000003372fdd6c nfnZR_8pCiU.dylib`jfptr_render_59047 + 60
    frame #9: 0x0000000337234450 nfnZR_8pCiU.dylib`julia_render_59006 at GLRender.jl:71
    frame #10: 0x000000033723449c nfnZR_8pCiU.dylib`jfptr_render_59007 + 56
    frame #11: 0x0000000337196eec nfnZR_8pCiU.dylib`julia_render_59126 at rendering.jl:132
    frame #12: 0x000000033719976c nfnZR_8pCiU.dylib`julia_YY.render_frameYY.160_60662 at rendering.jl:78
    frame #13: 0x0000000337199ff0 nfnZR_8pCiU.dylib`julia_refreshwindowcb_60106 at rendering.jl:29
    frame #14: 0x000000033719a100 nfnZR_8pCiU.dylib`julia_YY.82_60113 at screen.jl:959
    frame #15: 0x00000003372c1f60 nfnZR_8pCiU.dylib`jfptr_YY.82_60114 + 64
    frame #16: 0x0000000351fe80b8
    frame #17: 0x0000000199ee0428 QuartzCore`CA::Layer::display_if_needed(CA::Transaction*) + 744
    frame #18: 0x000000019a0651a4 QuartzCore`CA::Context::commit_transaction(CA::Transaction*, double, double*) + 512
    frame #19: 0x0000000199ec2e4c QuartzCore`CA::Transaction::commit() + 648
    frame #20: 0x00000001956589d0 AppKit`__62+[CATransaction(NSCATransaction) NS_setFlushesWithDisplayLink]_block_invoke + 272
    frame #21: 0x0000000196018208 AppKit`___NSRunLoopObserverCreateWithHandler_block_invoke + 64
    frame #22: 0x0000000191cd187c CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
    frame #23: 0x0000000191cd1768 CoreFoundation`__CFRunLoopDoObservers + 536
    frame #24: 0x0000000191cd0d94 CoreFoundation`__CFRunLoopRun + 776
    frame #25: 0x0000000191cd0434 CoreFoundation`CFRunLoopRunSpecific + 608
    frame #26: 0x000000019c47419c HIToolbox`RunCurrentEventLoopInMode + 292
    frame #27: 0x000000019c473e2c HIToolbox`ReceiveNextEventCommon + 220
    frame #28: 0x000000019c473d30 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 76
    frame #29: 0x000000019552fd68 AppKit`_DPSNextEvent + 660
    frame #30: 0x0000000195d25808 AppKit`-[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 700
    frame #31: 0x000000019580cfdc AppKit`-[NSWindow(NSWindowResizing) _resizeWithEvent:] + 612
    frame #32: 0x000000019572c2e4 AppKit`-[NSTitledFrame attemptResizeWithEvent:] + 156
    frame #33: 0x000000019572c0fc AppKit`-[NSThemeFrame handleMouseDown:] + 196
    frame #34: 0x00000001957a2894 AppKit`-[NSThemeFrame mouseDown:] + 32
    frame #35: 0x00000001956d0dcc AppKit`-[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 3472
    frame #36: 0x000000019565c40c AppKit`-[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 288
    frame #37: 0x000000019565c118 AppKit`-[NSWindow(NSEventRouting) sendEvent:] + 284
    frame #38: 0x0000000195d24828 AppKit`-[NSApplication(NSEventRouting) sendEvent:] + 1604
    frame #39: 0x0000000172bc0980 libglfw.3.4.dylib`_glfwPollEventsCocoa + 144
    frame #40: 0x000000033718474c nfnZR_8pCiU.dylib`julia_pollevents_59997 at glfw3.jl:702
    frame #41: 0x00000003372ac2b8 nfnZR_8pCiU.dylib`julia_on_demand_renderloop_60150 at screen.jl:1027
    frame #42: 0x000000033728a420 nfnZR_8pCiU.dylib`julia_renderloop_59760 at screen.jl:1055
    frame #43: 0x0000000337161898 nfnZR_8pCiU.dylib`jfptr_renderloop_59761 + 56
    frame #44: 0x000000033717e180 nfnZR_8pCiU.dylib`julia_YY.79_60101 at screen.jl:916
    frame #45: 0x00000003372a4aac nfnZR_8pCiU.dylib`jfptr_YY.79_60102 + 52
    frame #46: 0x0000000100a6e2ac libjulia-internal.1.11.3.dylib`start_task [inlined] jl_apply(args=0x0000000344cd3ba0, nargs=1) at julia.h:2157:12 [opt]
    frame #47: 0x0000000100a6e2a0 libjulia-internal.1.11.3.dylib`start_task at task.c:1202:19 [opt]

@SimonDanisch
Copy link
Member

Interesting that it happens in refreshwindowcb.. That gets triggert from the OS e.g. when the window gets focussed/uncovered.
It maybe, that the context is not active, or it gets called from e.g. a thread.
I'm not convinced this helps, but could you try this: #4785 ?
Also, you should set ENV["MODERNGL_DEBUGGING"] = "true", before loading any package.

@chriswaudby
Copy link
Author

chriswaudby commented Feb 12, 2025 via email

@chriswaudby
Copy link
Author

chriswaudby commented Feb 12, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug GLMakie This relates to GLMakie.jl, the OpenGL backend for Makie. Integration with other packages needs more info
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants