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

QWebView goes into an infinite loop if reply is aborted

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.5.1
    • 5.4.2, 5.5.0
    • Network, WebKit
    • None
    • OS X 10.10.4, PyQT 5.5, PyQT 5.4
    • 4a631c3a6e52ae53a2bad45e185cd51927d94bff

    Description

      Hey,

      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.

      Attachments

        For Gerrit Dashboard: QTBUG-47654
        # Subject Branch Project Status CR V

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes