-
Notifications
You must be signed in to change notification settings - Fork 152
macOS OpenGL crash race condition #108
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
Comments
p.s. here is the runtime trace from the above thread stack... Process 94969 launched: '/Users/michaelgale/bin/CQ-Editor.app/Contents/MacOS/CQ-Editor' (x86_64)
My path: /Users/michaelgale/bin/CQ-Editor.app/Contents/MacOS
casroot path: /Users/michaelgale/bin/CQ-Editor.app/Contents/MacOS/oce
Warning: QApplication was created before pyqtgraph was imported; there may be problems (to avoid bugs, call QApplication.setGraphicsSystem("raster") before the QApplication is created).
2020-01-06 11:52:12.054799-0500 CQ-Editor[94969:3464644] SecTaskLoadEntitlements failed error=22 cs_flags=20, pid=94969
2020-01-06 11:52:12.054923-0500 CQ-Editor[94969:3464644] SecTaskCopyDebugDescription: CQ-Editor[94969]/0#-1 LF=0
CQ-Editor(94969,0x100e60dc0) malloc: *** error for object 0x132a9f698: pointer being freed was not allocated
CQ-Editor(94969,0x100e60dc0) malloc: *** set a breakpoint in malloc_error_break to debug
Process 94969 stopped
* thread #1, name = 'ZMQbg/1', queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x00007fff670247fa libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
-> 0x7fff670247fa <+10>: jae 0x7fff67024804 ; <+20>
0x7fff670247fc <+12>: movq %rax, %rdi
0x7fff670247ff <+15>: jmp 0x7fff6701ea89 ; cerror_nocancel
0x7fff67024804 <+20>: retq
Target 0: (CQ-Editor) stopped. |
p.p.s. System Info: |
My hunch is that the macOS security gatekeeper tries to evaluate the app entitlements to access the file system (required by the OpenGL driver to load Shaders, etc.). This delays the initialization of the OpenGL driver enough to have the |
During my attempts to build standalone binaries of the CQ-Editor for macOS, I have discovered at least two mechanisms for the app to crash at launch. Both are related to OpenGL not being initialized. The first mechanism might be related to #106 and involve a race condition:
MainWindow
's__init__
method callsself.components['object_tree'].addLines()
self.sigObjectsAdded.emit(ais_list)
def display_many(self,ais_list,fit=None):
inviewer.py
context.Display(ais)
which resolves to theDisplay
method ofOCC.Display.qtDisplay.qtViewer3d
which resolves to_AIS.AIS_InteractiveContext_Display(self, *args)
This last call to AIS display occurs before the thread responsible for initializing the OpenGL driver and display context. We infer this is the case since we see no evidence of the initialization completed (usually a console message saying something about the layer manager).
There are definitely non thread safe conditions being established at application launch, especially the call to add the axis lines. When this is commented out, the app may or may not crash depending on the launch context (i.e. direct from terminal, lldb, or via the macOS
launchd
when initiated by the Finder or the terminalopen
command).The support stack trace is as follows...
The text was updated successfully, but these errors were encountered: