Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
None
-
6.1.3
-
OpenSSL version is 1.1.1l
Statically linked Qt
Description
Cleaning up QNetworkReply after handling it by calling deleteLater() occasionally crashes the application. Omitting the deleteLater() or calling it with a small timer removes the crash. Reproduce rate is moderate, but there is no sample application available to reproduce it.
The requests are HTTPS requests and there may be one or more ongoing requests due to network lag / delays. Portions of code that reproduces the issue:
QNetworkReply *reply = client->post(request, query.query().toUtf8());
connect(reply,
&QNetworkReply;::finished,
std::bind(&Net::handleKeepaliveResponse, this, reply, uid));
void Net::handleKeepaliveResponse(QNetworkReply *reply, u32 uid) { if (reply->error() != QNetworkReply::NoError) { reply->deleteLater(); return; } QJsonParseError jerr; QJsonObject json = QJsonDocument::fromJson(reply->readAll(), &jerr).object(); reply->deleteLater(); }
Stack trace:
> client.exe!QObjectPrivate::ConnectionData::deleteOrphaned(QObjectPrivate::ConnectionOrSignalVector * o) Line 448 C++ client.exe!QObjectPrivate::ConnectionData::cleanOrphanedConnectionsImpl(QObject * sender, QObjectPrivate::ConnectionData::LockPolicy lockPolicy) Line 441 C++ client.exe!QObjectPrivate::ConnectionData::cleanOrphanedConnections(QObject * sender, QObjectPrivate::ConnectionData::LockPolicy lockPolicy) Line 283 C++ client.exe!QObject::~QObject() Line 1080 C++ client.exe!QIODevice::~QIODevice() Line 499 C++ client.exe!QNetworkReply::~QNetworkReply() Line 470 C++ client.exe!QNetworkReplyHttpImpl::~QNetworkReplyHttpImpl() Line 253 C++ [External Code] client.exe!qDeleteInEventHandler(QObject * o) Line 4709 C++ client.exe!QObject::event(QEvent * e) Line 1312 C++ client.exe!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3410 C++ client.exe!QApplication::notify(QObject * receiver, QEvent * e) Line 2763 C++ client.exe!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1048 C++ client.exe!QCoreApplication::sendEvent(QObject * receiver, QEvent * event) Line 1457 C++ client.exe!QCoreApplicationPrivate::sendPostedEvents(QObject * receiver, int event_type, QThreadData * data) Line 1815 C++ client.exe!QEventDispatcherWin32::sendPostedEvents() Line 916 C++ client.exe!QWindowsGuiEventDispatcher::sendPostedEvents() Line 80 C++ client.exe!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 486 C++ client.exe!QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 72 C++ client.exe!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 140 C++ client.exe!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 232 C++ client.exe!QCoreApplication::exec() Line 1363 C++ client.exe!QGuiApplication::exec() Line 1889 C++ client.exe!QApplication::exec() Line 2616 C++ client.exe!main(int argc, char * * argv) Line 403 C++ client.exe!WinMain(HINSTANCE__ * __formal, HINSTANCE__ * __formal, char * __formal, int __formal) Line 97 C++ [External Code]
This issue may be related to QTBUG-38309, but the sample program in that bugreport has extremely low reproduce rate and I was not able to reproduce the issue with Qt 5.15.x and Qt 6.2.x. with that report's sample.