[PyQt] Occasional segfaults when using QApplication.quit

Florian Bruhin me at the-compiler.org
Tue Feb 11 19:13:09 GMT 2014


Heya,

I'm having problems with occasional segfaults when executing
QApplication.quit(), possibly related to libQt5Network.so and/or
QtWebkit.

First of all, the 3 test systems I'm using:

Arch:    Arch Linux, PyQt 5.2, Qt 5.2.0, Python 3.3.3
Ubuntu:  Ubuntu 13.10, PyQt 5.0.1, Qt 5.0.2, Python 3.3.2 in a VM
Windows: Windows 7, PyQt 5.2, Qt 5.2.0, Python 3.3.3

These crashes never happened on Arch for me so far, quite often on
Ubuntu, and from time to time in Windows. (though Windows is just a
guess, I just get this "python.exe is not working anymore" foo.)

I first noticed the problem in a big(ger) project, qutebrowser[1],
where it gave me this stacktrace when typing ":quit" (on Ubuntu):

[1] code: http://g.cmpl.cc/qutebrowser

-----------------
#0  0xb5c296fc in QMutex::lock() () from /usr/lib/i386-linux-gnu/libQt5Core.so.5
#1  0xb3bdd97d in ?? () from /usr/lib/i386-linux-gnu/libQt5Network.so.5
#2  0xb3bdf0d0 in ?? () from /usr/lib/i386-linux-gnu/libQt5Network.so.5
#3  0xb3bd4418 in ?? () from /usr/lib/i386-linux-gnu/libQt5Network.so.5
#4  0xb3bd8b1e in ?? () from /usr/lib/i386-linux-gnu/libQt5Network.so.5
#5  0xb5dedf10 in QMetaObject::activate(QObject*, int, int, void**) ()
   from /usr/lib/i386-linux-gnu/libQt5Core.so.5
#6  0xb5dee48b in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/i386-linux-gnu/libQt5Core.so.5
#7  0xb5e59155 in QIODevice::readyRead() ()
   from /usr/lib/i386-linux-gnu/libQt5Core.so.5
...
full stacktrace and coredump at http://t.cmpl.cc/qtcrash/qutebrowser
-----------------

Then I tried again with a minimal example[2] which quits itself
automatically after a second with a QTimer. I had to run it in a loop
for about a minute or so before it happened.

This gave me this very similiar stacktrace (on Ubuntu):

[2] code: http://t.cmpl.cc/qtcrash/minimal/minimal.py

-----------------
#0  0xb6cfd8d2 in QCoreApplication::postEvent(QObject*, QEvent*, int) ()
   from /usr/lib/i386-linux-gnu/libQt5Core.so.5
#1  0xb6d21c83 in QMetaObject::activate(QObject*, int, int, void**) ()
   from /usr/lib/i386-linux-gnu/libQt5Core.so.5
#2  0xb6d2248b in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/i386-linux-gnu/libQt5Core.so.5
#3  0xb3e47935 in ?? () from /usr/lib/i386-linux-gnu/libQt5Network.so.5
#4  0xb3dcf687 in ?? () from /usr/lib/i386-linux-gnu/libQt5Network.so.5
#5  0xb3e483b3 in ?? () from /usr/lib/i386-linux-gnu/libQt5Network.so.5
#6  0xb6d21f10 in QMetaObject::activate(QObject*, int, int, void**) ()
   from /usr/lib/i386-linux-gnu/libQt5Core.so.5
#7  0xb6d2248b in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/i386-linux-gnu/libQt5Core.so.5
#8  0xb3e43fe5 in ?? () from /usr/lib/i386-linux-gnu/libQt5Network.so.5
#9  0xb3d93b1e in ?? () from /usr/lib/i386-linux-gnu/libQt5Network.so.5
#10 0xb3d94630 in ?? () from /usr/lib/i386-linux-gnu/libQt5Network.so.5
#11 0xb3d9471b in ?? () from /usr/lib/i386-linux-gnu/libQt5Network.so.5
#12 0xb6d21f10 in QMetaObject::activate(QObject*, int, int, void**) ()
   from /usr/lib/i386-linux-gnu/libQt5Core.so.5
#13 0xb6d2248b in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/i386-linux-gnu/libQt5Core.so.5
#14 0xb6d8d155 in QIODevice::readyRead() ()
   from /usr/lib/i386-linux-gnu/libQt5Core.so.5
...
full stacktrace and coredump at http://t.cmpl.cc/qtcrash/minimal
-----------------

Anyone has an idea what's going wrong there? Some magic with stuff
being garbage-collected the wrong way around? I also tried some
workarounds[3] for similiar sympthoms on PyQt4, but that didn't
help either.

[3] can't find the StackOverflow-answer where it was descripted --
basically setting QtWidgets.qApp to the QApplication instance before
running exec_(), and to None afterwards.

Florian

-- 
() ascii ribbon campaign - stop html mail    www.asciiribbon.org
/\ www.the-compiler.org  | I love long mails http://email.is-not-s.ms/
Iron Law of Distribution: Them that has, gets. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140211/0ecede9d/attachment.pgp>


More information about the PyQt mailing list