Issue28567
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2016-10-31 10:26 by Alex Croitor, last changed 2022-04-11 14:58 by admin. This issue is now closed.
Files | ||||
---|---|---|---|---|
File name | Uploaded | Description | Edit | |
test_glutinit.py | Alex Croitor, 2016-10-31 10:26 |
Messages (2) | |||
---|---|---|---|
msg279777 - (view) | Author: Alex Croitor (Alex Croitor) | Date: 2016-10-31 10:26 | |
Hi, I'm building Python 2.7.11 with debug symbols and no optimizations, but without the --with-debug switch, on macOS 10.11.5, El Capitan + XCode 7.3.1. Whenever I try to execute an OpenGL demo or example, I get a segmentation fault or a bus error with a weird back trace. If I build Python2 in regular release mode (-O2) the demos run fine without crashing. I also tried building Python 3.5.2, both in release, and debug mode, and the demos do not crash either. What I tried after, was to update the files used in Modules/_ctypes/libffi_osx folder, with the latest version (libffi-3.2.1), and some small build adjustments, and then it doesn't crash anymore with -O0. But then I did a diff of libffi_osx on Python 2 and 3, and there are no significant differences there. So I assume the issue is somewhere in the _ctypes module code. Providing configure line for python2 (it was mostly the same for python3) ./configure --prefix="/usr/local/Cellar/python/2.7.11_custom" --enable-ipv6 --datarootdir=/usr/local/Cellar/python/2.7.11_custom/share --datadir=/usr/local/Cellar/python/2.7.11_custom/share --enable-framework=/usr/local/Cellar/python/2.7.11_custom/Frameworks --without-gcc MACOSX_DEPLOYMENT_TARGET=10.11 CFLAGS="-O0 -fno-inline -fno-omit-frame-pointer -g" LDFLAGS="-O0" CPPFLAGS="-O0" OPT="-O0 -g" CC="clang" Setting just -O0 without the no-inline and no-omit-frame-pointer does not influence anything, Python2 still crashes. Attaching a small python test from the opengl source package. And here is the backtrace: Process 32599 stopped * thread #1: tid = 0x15ecc1, 0x00007fff95bb2d11 AppKit`-[NSView _drawRect:clip:] + 3689, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT) frame #0: 0x00007fff95bb2d11 AppKit`-[NSView _drawRect:clip:] + 3689 AppKit`-[NSView _drawRect:clip:]: -> 0x7fff95bb2d11 <+3689>: movss %xmm0, (%r13,%r15) 0x7fff95bb2d18 <+3696>: movss 0x4(%r13,%r15), %xmm1 ; xmm1 = mem[0],zero,zero,zero 0x7fff95bb2d1f <+3703>: ucomiss %xmm0, %xmm1 0x7fff95bb2d22 <+3706>: jbe 0x7fff95bb2d2b ; <+3715> (lldb) bt error: unable to find CIE at 0x00000018 for cie_id = 0x00000004 for entry at 0x00000018. error: unable to find CIE at 0x00000050 for cie_id = 0x00000004 for entry at 0x00000050. error: time.so debug map object file '/Users/alex/Dev/python2_debug/Python-2.7.11/debug/build/temp.macosx-10.11-x86_64-2.7-pydebug/Users/alex/Dev/python2_debug/Python-2.7.11/Modules/timemodule.o' has changed (actual time is 0x58171936, debug map time is 0x58171933) since this executable was linked, file will be ignored * thread #1: tid = 0x15ecc1, 0x00007fff95bb2d11 AppKit`-[NSView _drawRect:clip:] + 3689, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT) * frame #0: 0x00007fff95bb2d11 AppKit`-[NSView _drawRect:clip:] + 3689 frame #1: 0x00007fff95c0acad AppKit`-[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1873 frame #2: 0x00007fff95c0b08a AppKit`-[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2862 frame #3: 0x00007fff95bb03fb AppKit`-[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 838 frame #4: 0x00007fff95bafbe0 AppKit`-[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 334 frame #5: 0x00007fff95badfeb AppKit`-[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 2449 frame #6: 0x00007fff95ba93f5 AppKit`-[NSView displayIfNeeded] + 1950 frame #7: 0x00007fff95ba8c3c AppKit`-[NSWindow displayIfNeeded] + 232 frame #8: 0x00007fff9622d41b AppKit`___NSWindowGetDisplayCycleObserver_block_invoke6365 + 476 frame #9: 0x00007fff95ba85d6 AppKit`__37+[NSDisplayCycle currentDisplayCycle]_block_invoke + 941 frame #10: 0x00007fff8ba17f71 QuartzCore`CA::Transaction::run_commit_handlers(CATransactionPhase) + 85 frame #11: 0x00007fff8ba1742c QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 160 frame #12: 0x00007fff8ba170ec QuartzCore`CA::Transaction::commit() + 508 frame #13: 0x00007fff8ba22977 QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 71 frame #14: 0x00007fff8dd47067 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23 frame #15: 0x00007fff8dd46fd7 CoreFoundation`__CFRunLoopDoObservers + 391 frame #16: 0x00007fff8dd25ef8 CoreFoundation`CFRunLoopRunSpecific + 328 frame #17: 0x00007fff8c95c3f6 Foundation`-[NSRunLoop(NSRunLoop) limitDateForMode:] + 201 frame #18: 0x00000001051c0232 GLUT`-[GLUTApplication run] + 269 frame #19: 0x00000001051cce59 GLUT`glutMainLoop + 254 frame #20: 0x00000001017818af _ctypes.so`ffi_call_unix64 + 79 at darwin64.S:76 frame #21: 0x000000010178253f _ctypes.so`ffi_call(cif=0x00007fff5fbfe610, fn=(GLUT`glutMainLoop), rvalue=0x00007fff5fbfe6a0, avalue=0x00007fff5fbfe6a0) + 1487 at x86-ffi64.c:581 frame #22: 0x000000010177782c _ctypes.so`_call_function_pointer(flags=4353, pProc=(GLUT`glutMainLoop), avalues=0x00007fff5fbfe6a0, atypes=0x00007fff5fbfe6a0, restype=0x00000001017899b0, resmem=0x00007fff5fbfe6a0, argcount=0) + 332 at callproc.c:836 frame #23: 0x0000000101776fd1 _ctypes.so`_ctypes_callproc(pProc=(GLUT`glutMainLoop), argtuple=0x0000000100321060, flags=4353, argtypes=0x0000000100321060, restype=0x0000000100213a28, checker=0x0000000000000000) + 1345 at callproc.c:1179 frame #24: 0x0000000101768214 _ctypes.so`PyCFuncPtr_call(self=0x0000000105276060, inargs=0x0000000100321060, kwds=0x0000000000000000) + 1172 at _ctypes.c:3965 frame #25: 0x0000000100016d32 Python`PyObject_Call(func=0x0000000105276060, arg=0x0000000100321060, kw=0x0000000000000000) + 130 at abstract.c:2546 frame #26: 0x0000000100156dd6 Python`do_call(func=0x0000000105276060, pp_stack=0x00007fff5fbfec80, na=0, nk=0) + 566 at ceval.c:4568 frame #27: 0x000000010015466a Python`call_function(pp_stack=0x00007fff5fbfec80, oparg=0) + 2138 at ceval.c:4373 frame #28: 0x000000010014e843 Python`PyEval_EvalFrameEx(f=0x0000000101625660, throwflag=0) + 65187 at ceval.c:2987 frame #29: 0x000000010013e893 Python`PyEval_EvalCodeEx(co=0x00000001016283b0, globals=0x0000000100395958, locals=0x0000000100395958, args=0x0000000000000000, argcount=0, kws=0x0000000000000000, kwcount=0, defs=0x0000000000000000, defcount=0, closure=0x0000000000000000) + 4979 at ceval.c:3582 frame #30: 0x000000010013d515 Python`PyEval_EvalCode(co=0x00000001016283b0, globals=0x0000000100395958, locals=0x0000000100395958) + 85 at ceval.c:669 frame #31: 0x000000010018ce22 Python`run_mod(mod=0x0000000103824050, filename="./test_glutinit.py", globals=0x0000000100395958, locals=0x0000000100395958, flags=0x00007fff5fbff660, arena=0x0000000101503b40) + 98 at pythonrun.c:1370 frame #32: 0x000000010018d28f Python`PyRun_FileExFlags(fp=0x00007fff7ae2b050, filename="./test_glutinit.py", start=257, globals=0x0000000100395958, locals=0x0000000100395958, closeit=1, flags=0x00007fff5fbff660) + 223 at pythonrun.c:1356 frame #33: 0x000000010018c5e9 Python`PyRun_SimpleFileExFlags(fp=0x00007fff7ae2b050, filename="./test_glutinit.py", closeit=1, flags=0x00007fff5fbff660) + 729 at pythonrun.c:948 frame #34: 0x000000010018c03c Python`PyRun_AnyFileExFlags(fp=0x00007fff7ae2b050, filename="./test_glutinit.py", closeit=1, flags=0x00007fff5fbff660) + 140 at pythonrun.c:752 frame #35: 0x00000001001afdff Python`Py_Main(argc=2, argv=0x00007fff5fbff700) + 4271 at main.c:640 frame #36: 0x0000000100000f82 Python`___lldb_unnamed_function1$$Python + 34 frame #37: 0x00007fffa03a25ad libdyld.dylib`start + 1 |
|||
msg294289 - (view) | Author: Ned Deily (ned.deily) * | Date: 2017-05-23 22:20 | |
Sorry that this issue has languished for so long. Unfortunately, since it is so easy to cause segfaults when using ctypes and there are so many variables in play here and that there haven't been other similar reports, it is highly unlikely that anyone is going to spend time trying to reproduce and then analyze this issue further. If you are still seeing problems and can further isolate or simplify the test case, feel feee to re-open this issue. If you haven't already, you might also want to check with the project providing the OpenGL bindings. Good luck! |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:58:38 | admin | set | github: 72753 |
2017-05-23 22:20:13 | ned.deily | set | status: open -> closed resolution: third party messages: + msg294289 stage: resolved |
2016-10-31 10:34:16 | SilentGhost | set | nosy:
+ ned.deily, ronaldoussoren components: + macOS |
2016-10-31 10:26:17 | Alex Croitor | create |