Details
-
Bug
-
Resolution: Cannot Reproduce
-
P2: Important
-
None
-
5.14.1
-
None
-
Windows 10, MSVC 2019 amd64
Description
I have come across instances when calling QNetworkAccessManager::get() for the first time, responses arrive extrememly slowly. Take the below snippet:
MyClass::MyClass() { manager_ = new QNetworkAccessManager(this); manager_->setAutoDeleteReplies(true); } void MyClass::make_call() { QNetworkRequest request; request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true); request.setUrl(QUrl("https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png")); qDebug() << "Starting request"; QNetworkReply *reply = manager_->get(request); connect(reply, &QNetworkReply::finished, this, &MyClass::reply_finished); } void MyClass::reply_finished() { qDebug() << "Request finished!"; make_call(); }
I just measured (very approximately with my phone stopwatch!) the time between printing "Starting request" and "Request finished!" to be just over 1 minute. After this extremely slow response time, subsequent get() calls take well under 1 second.
This appears to have related symptoms to to QTBUG-33315 that was closed due to being a duplicate of QTBUG-10106, but I cannot see how this is related - hence the new issue.
Mitigations Found so far:
- Running the code after rebooting my development machine seems to make the code run fast again. I am unsure at what point the call slows down/unable to reproduce this condition. As far as I can tell it happens after my machine has been up for about 10 minutes (I can repeatedly run/clean build straight after boot but at some point it stops working).
- Removing the request.setAttribute(...); in the above snippet causes the get() call to run in well under 1 second first time as one would expect. This is regardless of whether the issue is present with HTTP 2 enabled.