[PySide] Issues with threads after updating to PySide/shiboken 5.14.2

icfwm at gmx.net icfwm at gmx.net
Sun Apr 19 13:27:54 CEST 2020


Hi,

currently I am facing random crashes after an update to PySide/shiboken 5.14.2 which I believe are related to threads. I was not yet able to create a minimal example, so this report is just a shot in the dark hoping for tips and maybe similar experiences of other users. I have seen in the PySide/shiboken change logs that there were some larger changes with respect to threads and the python GIL.

My project is a PySide2 python application framework, which is extensible by developers using python and c++. Therefore, a c++ library has been wrapped using shiboken2, which provides the main interface for the plugins (plugins and the c++ library also use QT internally). The plugins can run in multiple threads, and they are communicating over QThread event loops (i.e., signal/slot connections). The interface is heavily using QSharedPointers (not sure if this matters).

Updating to PySide/shiboken 5.14.2 forced me to set allow-threads to true or auto for the c++ library wrapper since the default setting introduced dead-locking, probably due to the way the inter-thread communication has been implemented. Afterwards, everything seemed to work, but I am observing infrequent, hard-to-reproduce crashes, sometimes showing stack traces full of python3 / PySide / shiboken2 functions with neither of my own code nor shiboken wrappers of the c++ library in it. Sometimes stack traces seem to indicate that QSharedPointers are deleted too early while there are still active references.

Configuring the application to use only one thread heals the crashes. Going back to 5.14.1 using exactly same python, c++, and typesystem.xml doesn't show crashes as well, even when using multiple threads.

As being said above, I know that this report is not complete enough to put a finger on the problem and probably the root cause is somewhere in my own code. I'm just wondering if anyone else observes similar issues and I'd be glad about tips about what the root cause might be.

Best Regards
Christoph



More information about the PySide mailing list