App SEGFAULT when making a QNetworkAccessManager get request in Ubuntu 22 (Qt 6.2.4)
-
Hi, the porting of my app from Qt 5.12 in Ubuntu 20 to Qt 6.2.4 in U22 went well, except that it now crashes when trying to make a https request with QNetworkAccessManager.
This is the code:QNetworkAccessManager manager; QString base_url = "http://qt-project.org"; //Test url setNetworkReply(manager.get(QNetworkRequest(QUrl(base_url)))); ...And the SEGFAULT in question is the following:
[Thread 0x7fff14fff640 (LWP 4355) exited] [Detaching after fork from child process 4370] Thread 38 "Thread (pooled)" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fff61dfc640 (LWP 4322)] 0x00007fffebee5e94 in EVP_KEYMGMT_get0_name () from /lib/x86_64-linux-gnu/libcrypto.so.3 (gdb) bt #0 0x00007fffebee5e94 in EVP_KEYMGMT_get0_name () from /lib/x86_64-linux-gnu/libcrypto.so.3 #1 0x00007fffebef44e7 in ?? () from /lib/x86_64-linux-gnu/libcrypto.so.3 #2 0x00007fffebce33d3 in SSL_CTX_new_ex () from /lib/x86_64-linux-gnu/libssl.so.3 #3 0x00007fffec1b9787 in ?? () from /usr/lib/x86_64-linux-gnu/qt6/plugins/tls/libqopensslbackend.so #4 0x00007fffec1bae9c in ?? () from /usr/lib/x86_64-linux-gnu/qt6/plugins/tls/libqopensslbackend.so #5 0x00007ffff2a01873 in ?? () from /lib/x86_64-linux-gnu/libQt6Network.so.6 #6 0x00007ffff29f46a2 in QSslConfiguration::defaultConfiguration() () from /lib/x86_64-linux-gnu/libQt6Network.so.6 #7 0x00007ffff293c237 in QNetworkRequest::sslConfiguration() const () from /lib/x86_64-linux-gnu/libQt6Network.so.6 #8 0x00007ffff29caae4 in ?? () from /lib/x86_64-linux-gnu/libQt6Network.so.6 #9 0x00007ffff2928c35 in QNetworkAccessManager::createRequest(QNetworkAccessManager::Operation, QNetworkRequest const&, QIODevice*) () from /lib/x86_64-linux-gnu/libQt6Network.so.6 #10 0x00007ffff2926439 in QNetworkAccessManager::get(QNetworkRequest const&) () from /lib/x86_64-linux-gnu/libQt6Network.so.6 #11 0x00007ffff4d79b60 in LatestVersion::getLatestVersion (this=0x555555b84860, major=@0x7fff61dfb16c: 0, minor=@0x7fff61dfb168: 0) at ../../app/dialogs/LatestVersion.cpp:60 #12 0x00007ffff4d7a38a in LatestVersion::doCheckLatestVersion (this=0x555555b84860) at ../../app/dialogs/LatestVersion.cpp:127 #13 0x00007ffff4d7a7e3 in QtConcurrent::RunFunctionTaskBase<void>::run (this=0x555555f40390) at /usr/include/x86_64-linux-gnu/qt6/QtConcurrent/qtconcurrentrunbase.h:119 #14 0x00007ffff1754e32 in ?? () from /lib/x86_64-linux-gnu/libQt6Core.so.6 #15 0x00007ffff174ffcf in ?? () from /lib/x86_64-linux-gnu/libQt6Core.so.6 #16 0x00007ffff11f6ac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442 #17 0x00007ffff1288850 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81As you probably know, U22 provides Qt 6.2.4 as its version of Qt 6 (in the official repositories). The problem with this is that although U22 provides this version, Qt 6.2.4 does not support U22. This is reflected in Qt 6.2.4 not specifying which OpenSSL version to use in U22 (All distributions report some sort of OpenSSL 1.1.1 version, whereas U22 comes with OpenSSL 3.0.2
This is solved from Qt version 6.5.x onward, where Qt supports U22, and the version of OpenSSL that Qt expects is the same one that U22 provides (OpenSSL 3.0.2).The result of printing the OpenSSL versions is the following:
QWARN(QSslSocket::sslLibraryBuildVersionString()); QWARN(QSslSocket::sslLibraryBuildVersionNumber()); QWARN(QSslSocket::sslLibraryVersionString()); QWARN(QSslSocket::sslLibraryVersionNumber()); QWARN(QSslSocket::supportsSsl()); QWARN(QSslSocket::availableBackends()); OpenSSL 3.0.2 15 Mar 2022 805306400 OpenSSL 3.0.2 15 Mar 2022 805306400 true QList(cert-only, openssl)At this point I don't know if I'm missing a library or something for this to happen. Maybe Qt 6.2.4 is not supposed to work with OpenSSL 3, and I need to downgrade to OpenSSL 1.1.1 or upgrade to Qt 6.5.x
Any help is appreciated.
-
Hi, the porting of my app from Qt 5.12 in Ubuntu 20 to Qt 6.2.4 in U22 went well, except that it now crashes when trying to make a https request with QNetworkAccessManager.
This is the code:QNetworkAccessManager manager; QString base_url = "http://qt-project.org"; //Test url setNetworkReply(manager.get(QNetworkRequest(QUrl(base_url)))); ...And the SEGFAULT in question is the following:
[Thread 0x7fff14fff640 (LWP 4355) exited] [Detaching after fork from child process 4370] Thread 38 "Thread (pooled)" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fff61dfc640 (LWP 4322)] 0x00007fffebee5e94 in EVP_KEYMGMT_get0_name () from /lib/x86_64-linux-gnu/libcrypto.so.3 (gdb) bt #0 0x00007fffebee5e94 in EVP_KEYMGMT_get0_name () from /lib/x86_64-linux-gnu/libcrypto.so.3 #1 0x00007fffebef44e7 in ?? () from /lib/x86_64-linux-gnu/libcrypto.so.3 #2 0x00007fffebce33d3 in SSL_CTX_new_ex () from /lib/x86_64-linux-gnu/libssl.so.3 #3 0x00007fffec1b9787 in ?? () from /usr/lib/x86_64-linux-gnu/qt6/plugins/tls/libqopensslbackend.so #4 0x00007fffec1bae9c in ?? () from /usr/lib/x86_64-linux-gnu/qt6/plugins/tls/libqopensslbackend.so #5 0x00007ffff2a01873 in ?? () from /lib/x86_64-linux-gnu/libQt6Network.so.6 #6 0x00007ffff29f46a2 in QSslConfiguration::defaultConfiguration() () from /lib/x86_64-linux-gnu/libQt6Network.so.6 #7 0x00007ffff293c237 in QNetworkRequest::sslConfiguration() const () from /lib/x86_64-linux-gnu/libQt6Network.so.6 #8 0x00007ffff29caae4 in ?? () from /lib/x86_64-linux-gnu/libQt6Network.so.6 #9 0x00007ffff2928c35 in QNetworkAccessManager::createRequest(QNetworkAccessManager::Operation, QNetworkRequest const&, QIODevice*) () from /lib/x86_64-linux-gnu/libQt6Network.so.6 #10 0x00007ffff2926439 in QNetworkAccessManager::get(QNetworkRequest const&) () from /lib/x86_64-linux-gnu/libQt6Network.so.6 #11 0x00007ffff4d79b60 in LatestVersion::getLatestVersion (this=0x555555b84860, major=@0x7fff61dfb16c: 0, minor=@0x7fff61dfb168: 0) at ../../app/dialogs/LatestVersion.cpp:60 #12 0x00007ffff4d7a38a in LatestVersion::doCheckLatestVersion (this=0x555555b84860) at ../../app/dialogs/LatestVersion.cpp:127 #13 0x00007ffff4d7a7e3 in QtConcurrent::RunFunctionTaskBase<void>::run (this=0x555555f40390) at /usr/include/x86_64-linux-gnu/qt6/QtConcurrent/qtconcurrentrunbase.h:119 #14 0x00007ffff1754e32 in ?? () from /lib/x86_64-linux-gnu/libQt6Core.so.6 #15 0x00007ffff174ffcf in ?? () from /lib/x86_64-linux-gnu/libQt6Core.so.6 #16 0x00007ffff11f6ac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442 #17 0x00007ffff1288850 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81As you probably know, U22 provides Qt 6.2.4 as its version of Qt 6 (in the official repositories). The problem with this is that although U22 provides this version, Qt 6.2.4 does not support U22. This is reflected in Qt 6.2.4 not specifying which OpenSSL version to use in U22 (All distributions report some sort of OpenSSL 1.1.1 version, whereas U22 comes with OpenSSL 3.0.2
This is solved from Qt version 6.5.x onward, where Qt supports U22, and the version of OpenSSL that Qt expects is the same one that U22 provides (OpenSSL 3.0.2).The result of printing the OpenSSL versions is the following:
QWARN(QSslSocket::sslLibraryBuildVersionString()); QWARN(QSslSocket::sslLibraryBuildVersionNumber()); QWARN(QSslSocket::sslLibraryVersionString()); QWARN(QSslSocket::sslLibraryVersionNumber()); QWARN(QSslSocket::supportsSsl()); QWARN(QSslSocket::availableBackends()); OpenSSL 3.0.2 15 Mar 2022 805306400 OpenSSL 3.0.2 15 Mar 2022 805306400 true QList(cert-only, openssl)At this point I don't know if I'm missing a library or something for this to happen. Maybe Qt 6.2.4 is not supposed to work with OpenSSL 3, and I need to downgrade to OpenSSL 1.1.1 or upgrade to Qt 6.5.x
Any help is appreciated.
@ltrincheri I would recommend you to install the latest Qt 6.6.2. There are tons of changes in Qt6 and Qt 6.2.4 is old in Qt6.