[PyQt] Segfault on exit with QSslSocket and qInstallMessageHandler

Hans-Peter Jansen hpj at urpla.net
Fri Jun 2 18:18:27 BST 2017


Hi Florian,

given the hassle, that OpenSSL 1.1 produces all over the world (compared to 
and together with 1.0.2), I would expect this unfortunate outcome. The OpenSSL 
creators don't give a fuzz on backwards compatibility (especially not on 
binary..).

If you really want Qt to behave SSL wise, you will want to build Qt with 
OpenSSL 1.1 first (fingers crossed).

I expect PyQt to behave, if you succeed with above...
The backtrace seems to undergird my theory.

Let us know about your findings, please.

Cheers & good luck,
Pete

On Freitag, 2. Juni 2017 18:12:28 Florian Bruhin wrote:
> Hi,
> 
> When running the PyQt wheels with OpenSSL 1.1, a lot of stuff gets
> logged because symbols can't be resolved (as they're built against 1.0).
> 
> This logging seems to cause a segfault on exit:
> 
> 	from PyQt5.QtCore import qInstallMessageHandler
> 	from PyQt5.QtNetwork import QSslSocket
> 	qInstallMessageHandler(lambda typ, ctx, msg: print(msg))
> 	QSslSocket.supportsSsl()
> 
> Log:
> 
> 	QSslSocket: cannot resolve CRYPTO_num_locks
> 	[...]
> 	QSslSocket: cannot call unresolved function SSL_library_init
> 
> 	Program received signal SIGSEGV, Segmentation fault.
> 	0x00007ffff7bcbdd9 in sem_wait@@GLIBC_2.2.5 () from
> /usr/lib/libpthread.so.0 (gdb) bt
> 	#0  0x00007ffff7bcbdd9 in sem_wait@@GLIBC_2.2.5 () from
> /usr/lib/libpthread.so.0 #1  0x00007ffff73ae9e5 in
> PyThread_acquire_lock_timed () from /usr/lib/libpython3.6m.so.1.0 #2 
> 0x00007ffff74a620d in ?? () from /usr/lib/libpython3.6m.so.1.0 #3 
> 0x00007ffff73439cb in ?? () from /usr/lib/libpython3.6m.so.1.0 #4 
> 0x00007ffff6545047 in qtcore_MessageHandler(QtMsgType, QMessageLogContext
> const&, QString const&) () from .../site-packages/PyQt5/QtCore.so #5 
> 0x00007ffff5de14f8 in ?? () from
> .../site-packages/PyQt5/Qt/lib/libQt5Core.so.5 #6  0x00007ffff5de21e9 in
> QMessageLogger::warning(char const*, ...) const () from
> .../site-packages/PyQt5/Qt/lib/libQt5Core.so.5 #7  0x00007ffff220bf08 in ??
> () from .../site-packages/PyQt5/Qt/lib/libQt5Network.so.5 #8 
> 0x00007ffff220c300 in ?? () from
> .../site-packages/PyQt5/Qt/lib/libQt5Network.so.5 #9  0x00007ffff220716c in
> ?? () from .../site-packages/PyQt5/Qt/lib/libQt5Network.so.5 #10
> 0x00007ffff784d298 in __run_exit_handlers () from /usr/lib/libc.so.6 #11
> 0x00007ffff784d2ea in exit () from /usr/lib/libc.so.6
> 	#12 0x00007ffff7837441 in __libc_start_main () from /usr/lib/libc.so.6
> 	#13 0x0000000000400b9a in _start ()
> 
> Adding a QCoreApplication to the example doesn't change anything.
> 
> Florian



More information about the PyQt mailing list