Closed marsipu closed 1 year ago
@GuillaumeFavelier Do you know something about this problem?
With mne==0.24.1
this bug doesn't seem to appear
I tried to reproduce and it only crashes when the window receives an event (in my case: moving the mouse cursor), like you said. This is on macOS (btw, this is the way it's supposed to be spelled ;)) 12.3.1
https://user-images.githubusercontent.com/2046265/169799833-48fc076c-6ea3-4109-a5d2-47b3b0cafd0c.mov
I'll take a look, see if I can reproduce, and then try to fix it hopefully today
@larsoner Thank you, I tried to get behind it but this segmentation fault is so hard to debug since it gives little clue what the problem is
I added a import faulthandler; faulthandler.enable()
but it didn't provide any additional information. I also added some debugging prints at various points in _brain
, pyvista
, and pyvistaqt
and couldn't figure this one out. I wonder if we need a debug build of Qt where we can get a useful traceback :(
Okay I say that.... then almost immediately look up debugging on macOS and get a bit farther:
$ lldb python
(lldb) process launch -- -u /Users/larsoner/Desktop/rep.py
...
2022-05-24 16:15:37.299227-0400 python[91919:796914] [qt.qpa.drawing] Layer-backing is always enabled. QT_MAC_WANTS_LAYER/_q_mac_wantsLayer has no effect.
Process 91919 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x843e643d642455)
frame #0: 0x0000000154953088 libvtkRenderingOpenGL2-9.1.9.1.0.dylib`-[vtkCocoaGLView modifyDPIForBackingScaleFactorOfWindow:] + 164
libvtkRenderingOpenGL2-9.1.9.1.0.dylib`-[vtkCocoaGLView modifyDPIForBackingScaleFactorOfWindow:]:
-> 0x154953088 <+164>: ldr x2, [x8, #0x1f0]
0x15495308c <+168>: ldp x29, x30, [sp, #0x20]
0x154953090 <+172>: ldp x20, x19, [sp, #0x10]
0x154953094 <+176>: ldp d9, d8, [sp], #0x30
Next up is probably to look into why the DPI modification here causes a segfault.
So it's likely a VTK bug?
Yeah, let's see what they say
The related VTK issue was closed a year ago and I just tried the MWE at the top and now it's fine!
Describe the bug
When an instance of
mne.viz.Brain
is shown from within an already running instance ofQApplication
, the python interpreter crashes with a SegmentationError. This happens only on macOS.Steps to reproduce
Expected results
Brain is shown and the already running QApplication works with
pyvistaqt
.Actual results
Somehow interacting with the opened Brain-Window (moving the mouse) causes a
SegmentationError
and breaks the python interpreter.SegmentationError
------------------------------------- Translated Report (Full Report Below) ------------------------------------- Process: python3.10 [1841] Path: /Users/USER/*/python Identifier: python3.10 Version: ??? Code Type: X86-64 (Native) Parent Process: zsh [1815] Responsible: Terminal [1812] User ID: 501 Date/Time: 2022-05-20 20:44:28.4389 +0200 OS Version: macOS 12.3.1 (21E258) Report Version: 12 Anonymous UUID: BF4802CD-9CFE-42B1-859F-25CDBA0EE5BD Time Awake Since Boot: 1300 seconds System Integrity Protection: enabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x00000000006b6f64 Exception Codes: 0x0000000000000001, 0x00000000006b6f64 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11 Terminating Process: exc handler [1841] VM Region Info: 0x6b6f64 is not in any region. Bytes before following region: 4412035228 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL UNUSED SPACE AT START ---> __TEXT 10765c000-1079d0000 [ 3536K] r-x/r-x SM=COW .../*/python3.10 Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 ??? 0x6b6f64 ??? 1 libvtkRenderingOpenGL2-9.1.9.1.0.dylib 0x16e487bb9 -[vtkCocoaGLView modifyDPIForBackingScaleFactorOfWindow:] + 249 2 libvtkRenderingOpenGL2-9.1.9.1.0.dylib 0x16e487c31 -[vtkCocoaGLView viewWillMoveToWindow:] + 81 3 AppKit 0x7ff811b1740a -[NSView _setWindow:] + 277 4 AppKit 0x7ff812367864 __21-[NSView _setWindow:]_block_invoke.425 + 299 5 AppKit 0x7ff811b17a74 -[NSView _setWindow:] + 1919 6 AppKit 0x7ff811d6d6f2 -[NSWindow dealloc] + 882 7 libobjc.A.dylib 0x7ff80eeaf14a AutoreleasePoolPage::releaseUntil(objc_object**) + 164 8 libobjc.A.dylib 0x7ff80eeabf8f objc_autoreleasePoolPop + 168 9 AppKit 0x7ff811aff6fd -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 4213 10 AppKit 0x7ff811af12a9 -[NSApplication run] + 586 Thread 1: 0 libsystem_kernel.dylib 0x7ff80efdb3ea __psynch_cvwait + 10 1 libsystem_pthread.dylib 0x7ff80f015a6f _pthread_cond_wait + 1249 2 libomp.dylib 0x1081097ab void __kmp_suspend_64Additional information
mne sys_info
Platform: macOS-12.3.1-x86_64-i386-64bit Python: 3.10.4 | packaged by conda-forge | (main, Mar 24 2022, 17:43:32) [Clang 12.0.1 ] Executable: /Users/martinschulz/opt/anaconda3/envs/mnedev/bin/python3.1 CPU: i386: 8 cores Memory: 16.0 GB mne: 1.1.dev0 numpy: 1.21.5 {blas=NO_ATLAS_INFO, lapack=lapack} scipy: 1.8.0 matplotlib: 3.5.1 {backend=MacOSX} sklearn: 1.0.2 numba: 0.55.1 nibabel: 3.2.2 nilearn: 0.9.0 dipy: 1.5.0 cupy: Not found pandas: 1.4.2 pyvista: 0.33.3 {OpenGL 4.1 INTEL-18.5.8 via Intel(R) Iris(TM) Plus Graphics 655} pyvistaqt: 0.9.0 ipyvtklink: 0.2.2 vtk: 9.1.0 qtpy: 2.0.1 {PyQt5=5.12.3} ipympl: Not found pooch: v1.6.0 mne_bids: 0.11.dev0 mne_nirs: Not found mne_features: Not found mne_qt_browser: 0.2.7.dev0 mne_connectivity: 0.4dev0