Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.6.3
-
None
-
RHEL 6.6 CI machine
glib 2.28.4
Description
There seems to be a race condition inside glib thread initialisation which can lead to application crashes. This is exposed by the interaction between the qt gtk2 theme plugin, and the QXcbEventReader QThread which uses QEventDispatcherGlib.
Specifically it can happen that the internal glib2 flag that signifies "thread initialisation is complete" can be set before all resources are initialised, and then another thread tries to access something which was not yet created.
A slightly more detailed explanation describing which function calls lead to this is described in the commit message https://codereview.qt-project.org/#/c/212388/
My assumption is that these crashes won't happen on glib versions > 2.32, because glib thread initialisation is done at the start of the program, as described here https://developer.gnome.org/glib/2.32/glib-Deprecated-Thread-APIs.html#g-thread-init , which I assume means "statically".
I'm not sure if this is a bug in glib2, or it is API misuse by Qt.
Consistent crashes in the CI have been seen in pyside tests that instantiate QApplications, but can be reproduced locally only when the CPU is stressed with "stress" utility.
We have worked around this in PySide by setting the QT_NO_THREADED_GLIB environment variable.
I attached a backtrace of the threads leading to the crash.
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-64716 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
212388,8 | Fix crashes on RHEL 6.6 CI machines due to a race condition in glib2 | 5.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |