Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
5.15.2
-
None
-
Debian GNU/Linux unstable amd64
Python 3.9.1
-
-
dbcfbecf596704efaa25d028bfcad09f73c185d3 (pyside/pyside-setup/6.0) c1f776570adbe4f9aa21aa818a82f5ebd1258a76 (pyside/pyside-setup/dev) 72485050f28e3d9f6f99c2f9d112d451f5066d4e (pyside/pyside-setup/5.15)
Description
In Debian, pyside2 builds started to fail because pyside2:QtWidgets::bug_307 is a newly detected test failure. Maybe it is related to Python 3.9, which became the default version recently.
The segfault happens on exit, after the test has run successfully. The stack trace is:
Thread 1 "python3" received signal SIGSEGV, Segmentation fault. 0x0000000000545563 in _PyObject_GC_UNTRACK_impl (op= <Test(_called=True, __METAOBJECT__=<PyCapsule at remote 0x7ffff1548ea0>) at remote 0x7ffff1548f90>, lineno=2200, filename=<synthetic pointer>) at ../Include/internal/pycore_object.h:74 74 ../Include/internal/pycore_object.h: No such file or directory. #0 0x0000000000545563 in _PyObject_GC_UNTRACK_impl ( op=<Test(_called=True, __METAOBJECT__=<PyCapsule at remote 0x7ffff1548ea0>) at remote 0x7ffff1548f90>, lineno=2200, filename=<synthetic pointer>) at ../Include/internal/pycore_object.h:74 #1 PyObject_GC_UnTrack (op_raw=0x7ffff1548f90) at ../Modules/gcmodule.c:2200 #2 subtype_dealloc (self=<Test(_called=True, __METAOBJECT__=<PyCapsule at remote 0x7ffff1548ea0>) at remote 0x7ffff1548f90>) at ../Objects/typeobject.c:1251 #3 0x00000000004facc7 in _Py_Dealloc (op=<optimized out>) at ../Objects/object.c:2209 #4 _Py_DECREF (op=<optimized out>) at ../Include/object.h:430 #5 _Py_XDECREF (op=<optimized out>) at ../Include/object.h:497 #6 insertdict (mp=<optimized out>, key='qApp', hash=<optimized out>, value=<optimized out>) at ../Objects/dictobject.c:1123 #7 0x00007ffff77c9d85 in monitor_qApp_var (qApp=None) at ./sources/shiboken2/libshiboken/qapp_macro.cpp:75 #8 MakeQAppWrapper (type=<optimized out>, type@entry=0x0) at ./sources/shiboken2/libshiboken/qapp_macro.cpp:95 #9 0x00007ffff6fde980 in PySide::destroyQCoreApplication () at ./sources/pyside2/libpyside/pyside.cpp:215 #10 0x00007ffff6fdf9a1 in PySide::runCleanupFunctions () at ./sources/pyside2/libpyside/pyside.cpp:170 #11 0x00007ffff72d8c45 in SbkQtCoreModule___moduleShutdown (self=<optimized out>) at ./pyside3_build/py3.9-qt5.15.1-64bit-relwithdebinfo/pyside2/PySide2/QtCore/PySide2/QtCore/qtcore_module_wrapper.cpp:789 #12 0x000000000052607e in cfunction_vectorcall_NOARGS (func=<built-in method __moduleShutdown of module object at remote 0x7ffff7863e00>, args=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at ../Objects/methodobject.c:485 #13 0x0000000000630870 in atexit_callfuncs (module=<optimized out>) at ../Modules/atexitmodule.c:93 #14 0x000000000061abcd in call_py_exitfuncs (tstate=0x9638b0) at ../Python/pylifecycle.c:2374 #15 0x0000000000619fed in Py_FinalizeEx () at ../Python/pylifecycle.c:1373 #16 0x000000000062b7e8 in Py_Exit (sts=0) at ../Python/pylifecycle.c:2433 #17 0x000000000061bbbb in handle_system_exit () at ../Python/pythonrun.c:696 #18 0x000000000061ba02 in _PyErr_PrintEx (set_sys_last_vars=1, tstate=0x9638b0) at ../Python/pythonrun.c:706 #19 PyErr_PrintEx (set_sys_last_vars=1) at ../Python/pythonrun.c:801 #20 0x0000000000618fce in PyErr_Print () at ../Python/pythonrun.c:807 #21 PyRun_SimpleFileExFlags (fp=<optimized out>, filename=<optimized out>, closeit=<optimized out>, flags=0x7fffffffe2a8) at ../Python/pythonrun.c:444 #22 0x000000000060c903 in pymain_run_file (cf=0x7fffffffe2a8, config=0x962210) at ../Modules/main.c:373 #23 pymain_run_python (exitcode=0x7fffffffe2a0) at ../Modules/main.c:598 #24 Py_RunMain () at ../Modules/main.c:677 #25 0x00000000005e9799 in Py_BytesMain (argc=<optimized out>, argv=<optimized out>) at ../Modules/main.c:731 #26 0x00007ffff7c60d0a in __libc_start_main (main=0x5e9760 <main>, argc=2, argv=0x7fffffffe498, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe488) at ../csu/libc-start.c:308 #27 0x00000000005e969a in _start ()
I tried to analyze what happens here:
- PySide2 tries to set __globals__.qApp = None.
- That dictionary already had a qApp, so Python dereferences the previous value.
- Because it had only one reference, it gets garbage collected. But then something gets wrong.
I reproduced this with two different PySide versions: 5.15.0 and 5.15.2.
Attachments
Issue Links
- is duplicated by
-
PYSIDE-1805 Crash when instantiating QApplication subclass within main()
- Closed
For Gerrit Dashboard: PYSIDE-1447 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
328046,3 | qApp: fix flag handling in Python 3.8+ and a Python 3.9 issue | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
328047,5 | basewrapper: clear all traces of special Q*Application treatment | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
328394,2 | qApp: fix flag handling in Python 3.8+ and a Python 3.9 issue | 6.0 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
328395,3 | qApp: fix flag handling in Python 3.8+ and a Python 3.9 issue | 5.15 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
328443,2 | basewrapper: clear all traces of special Q*Application treatment | 6.0 | pyside/pyside-setup | Status: MERGED | +2 | 0 |