FS#51285 - [qt5-base] segfault at exit of any PyQt5 application

Attached to Project: Arch Linux
Opened by Antony Lee (anntzer) - Saturday, 08 October 2016, 04:55 GMT
Last edited by Antonio Rojas (arojas) - Thursday, 02 February 2017, 17:54 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Antonio Rojas (arojas)
Felix Yan (felixonmars)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:
Any PyQt5 application segfaults at exit. See below for steps for reproducing.


Additional info:
* qt5-base 5.7.0-3, python-pyqt5 5.7-2.
* The segfault does NOT occur with the debug build of qt5-base provided at https://wiki.archlinux.org/index.php/Unofficial_user_repositories#qt-debug.


Steps to reproduce:

$ python -c 'from PyQt5.QtWidgets import *; app = QApplication([]); win = QMainWindow(); win.show()'
QSettings::value: Empty key passed
QSettings::value: Empty key passed
[1] 18384 segmentation fault (core dumped) python -c

Alternatively, add 'app.exec_()' at the end of the command; the segfault occurs when the user closes the window that appears.

The gdb backtrace is

(gdb) run -c 'from PyQt5.QtWidgets import *; app = QApplication([]); win = QMainWindow(); win.show()'
Starting program: /usr/bin/python -c 'from PyQt5.QtWidgets import *; app = QApplication([]); win = QMainWindow(); win.show()'
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffe999d700 (LWP 18452)]
QSettings::value: Empty key passed
[New Thread 0x7fffdbe98700 (LWP 18453)]
QSettings::value: Empty key passed

Thread 3 "QDBusConnection" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffdbe98700 (LWP 18453)]
0x00007ffff4cf59cf in QObject::disconnect(QObject const*, char const*, QObject const*, char const*) () from /usr/lib/libQt5Core.so.5
(gdb) bt
#0 0x00007ffff4cf59cf in QObject::disconnect(QObject const*, char const*, QObject const*, char const*) () from /usr/lib/libQt5Core.so.5
#1 0x00007fffea022530 in ?? () from /usr/lib/libQt5DBus.so.5
#2 0x00007fffea00ef62 in ?? () from /usr/lib/libQt5DBus.so.5
#3 0x00007ffff4aebd78 in ?? () from /usr/lib/libQt5Core.so.5
#4 0x00007ffff76f6454 in start_thread () from /usr/lib/libpthread.so.0
#5 0x00007ffff74397df in clone () from /usr/lib/libc.so.6
This task depends upon

Closed by  Antonio Rojas (arojas)
Thursday, 02 February 2017, 17:54 GMT
Reason for closing:  Fixed
Comment by Antonio Rojas (arojas) - Saturday, 08 October 2016, 07:31 GMT
I suppose it's fixed by this patch https://github.com/qutebrowser/qt-debug-pkgbuild/blob/master/qt5-base/qtbug-52988-all.patch

But that's still under review upstream
Comment by Antony Lee (anntzer) - Sunday, 09 October 2016, 06:14 GMT
Ah, I should have paid more attention to the debug PKGBUILD.
Any chance this patch could be applied to the official Arch PKGBUILD as well? In particular I noticed the same error message at the *startup* of autostarted applications (yakuake, rsibreak and kalarm in my case). Thanks!
Comment by Antonio Rojas (arojas) - Sunday, 09 October 2016, 20:29 GMT
The patch seems to cause other issues, see https://codereview.qt-project.org/#/c/172173/
So it doesn't look safe to me to apply this for now.
Comment by Florian Bruhin (The-Compiler) - Wednesday, 12 October 2016, 14:39 GMT
I'm the maintainer of the qt-debug packages and created the combined patch linked above. The codereview page you linked seems to be unrelated, as that's for 5.6 and not contained in my patch.

The problematic patches are https://codereview.qt-project.org/#/c/157488/ and https://codereview.qt-project.org/#/c/161056/ - they're not applied upstream yet because of "QMutex: destroying locked mutex" warnings nobody could track down so far.

I've been running with that patch without any issues for months now, and so have various other people - I've never seen those warnings, and I've never seen segfaults on exit anymore.
Comment by dhead666 (dhead666) - Monday, 05 December 2016, 14:51 GMT
The patch mentioned by arojas does fix an issue with calibre, without it calibre fails to output pdf (e.g. converting epub to pdf), to reproduce it one just need to convert something to pdf.
I don't have time to further debug this but it seems threads related and it ends with a segfault.

I've seen another issue with calibre in which it grabs the mouse pointer focus and doesn't release it so I'm forced to change to another tty and then return back to the active desktop tty to release the pointer, the patch doesn't fix this issue which seems limited to qt, it does take a little time to reproduce this bug and I've not seen any error message in the logs (maybe I need to run wayland/xwayland in debug mode).

Anyway, I just thought it would be a good idea to mention this here, I'll also report this to the calibre package maintainer.
Comment by Antonio Rojas (arojas) - Thursday, 02 February 2017, 09:15 GMT
Any improvement as of 5.8?
Comment by dhead666 (dhead666) - Thursday, 02 February 2017, 09:27 GMT
I don't experience thread related segfaults anymore.
Comment by Florian Bruhin (The-Compiler) - Thursday, 02 February 2017, 09:47 GMT
I haven't seen any segfaults on exit with 5.8 anymore either.
Comment by Antony Lee (anntzer) - Thursday, 02 February 2017, 17:37 GMT
It looks fixed indeed.
Comment by Antonio Rojas (arojas) - Thursday, 02 February 2017, 17:53 GMT
Thanks for the feedback

Loading...