Details
-
Bug
-
Resolution: Incomplete
-
P2: Important
-
None
-
5.12.4, 5.15.2, 5.15.9
-
-
8
Description
User contacted Qt Support about following issue:
"
We are using a few QNetworkAccessManager (NAM) instances /w and /wo a HTTP Proxy. The connection with a proxy will completely stall when calling QNetworkReply::abort at least 2 times per concurrent connection.
When a request runs into a timeout, we called QNetworkReply::abort. After a few timeouts (e.g. due to Proxy not reaching target server) this led to the QNetworkAccessManager stalling and not sending new requests to the Proxy. Actually restarting the proxy doesn't solve the issue - NAM remains silent and wont despatch new requests.
Calling QNetworkReply::close instead solves our issue, but sounds wrong according to the documentation.
"
We tested this at Qt Support with:
#include <QApplication> #include <QDebug> #include <QNetworkAccessManager> #include <QNetworkProxy> #include <QNetworkReply> #include <QTimer> int main(int argc, char *argv[]) { QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication a(argc, argv); QNetworkAccessManager m; QNetworkProxy proxy; proxy.setHostName("localhost"); proxy.setPort(1337); proxy.setType(QNetworkProxy::Socks5Proxy); m.setProxy(proxy); for (int i = 0; i < 16; ++i) { auto first = m.get(QNetworkRequest(QUrl("http://nonexistent"))); QObject::connect(first, &QNetworkReply::finished, [] { qDebug("nonexistent finished"); }); QTimer::singleShot(100, [first](){first->abort();}); } QTimer::singleShot(1000, [&m](){ auto second = m.get(QNetworkRequest(QUrl("http://google.com"))); QObject::connect(second, &QNetworkReply::finished, []{ qDebug("google finished"); }); }); return a.exec(); }
And we never got the "google finished".