Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-47654

QWebView goes into an infinite loop if reply is aborted


    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 5.4.2, 5.5.0
    • Fix Version/s: 5.5.1
    • Component/s: Network, WebKit
    • Labels:
    • Environment:
      OS X 10.10.4, PyQT 5.5, PyQT 5.4
    • Commits:



      I'm using WebView with a custom NetworkAccessManager via PyQt5 and porting an app from QT4 to QT5. A a custom NetworkAccessManager implements network request timeouts: after a timeout reply.abort() is called. It used to work fine in Qt4, but Qt5 in some cases goes into an infinite loop printing

      QIODevice::read (QNetworkReplyHttpImpl): device not open

      messages. It happens when a remote server accepts connection, sends initial Content-Type header, then sends some data (a few bytes), and then waits doing nothing.

      If a server accepts connection, sends Content-Type header and then waits without sending the data, qt doesn't go into an infinite loop, but prints a single message:

      QIODevice::read (QNetworkReplyHttpImpl): device not open

      An example to reproduce this issue (in PyQT): https://gist.github.com/kmike/ff287998e02fa953b4a2.
      Problematic resource implementation (in Twisted, I'm not sure if it is useful for you): https://github.com/scrapinghub/splash/blob/64014968fa6e9d5a88fd131b246ddfc875a50039/splash/tests/mockserver.py#L218

      I've attached a file with an OS X sample of a process when it is in an infinite loop. It looks like reply.abort() triggers "fiished" signal, which in turn triggers MIME sniffing, and then sniffer tries to read from a closed reply, and for some reason 'finished' is fired again.

      If all 'finished' handlers are disconnect from reply before calling reply.abort (this line is commented out in example), then there is no infinite loop, but one 'device not open' message is still printed. WebView is not working properly in this case, so it is not a workaround.


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            • Assignee:
              richmoore Richard Moore (qtnetwork)
              kmike Mikhail Korobov
            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created:

                Gerrit Reviews

                There are no open Gerrit changes