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

windows - QSocketNotifier doesn't cope with FD_CLOSE being signalled only once

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.0.0
    • 4.8.1, 5.0.0
    • Core: I/O
    • None
    • b8453b6fe3552cdfe32c726f87bb30d897c679b0

    Description

      QAbstractSocket, QNativeSocketEngine etc rely on QSocketNotifier having unix like behaviour when the socket is closed.
      i.e. if you enable the read notifier, and the socket is already closed by the remote then it will trigger next time the event loop is entered.

      On windows, WSAAsyncSelect (and WSAEventSelect) will only send the FD_CLOSE event once. There is no way to re-enable it to be sent again.
      This is in contrast to FD_READ which behaves as expected as long as the socket is connected.
      When receiving TCP FIN or RST, FD_CLOSE is signalled exactly once.

      Currently we treat FD_CLOSE and FD_READ the same, which works most of the time.
      The problems happen when not all of the data is read, or the exact amount of available data is read but the client code expects another readyRead() signal.

      This seems to cause some unstable autotests e.g. tst_QNetworkReply::ioPostToHttpFromSocket(128k+1 ...) often fails on windows because the readyRead() signal expected when the socket is closed is not received.
      QNetworkReplyHttpImplPrivate::_q_bufferOutgoingData is called multiple times, and all the expected data is received.
      However QNetworkReplyHttpImplPrivate::_q_bufferOutgoingDataFinished is not called.

      Attachments

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

        Activity

          People

            xcm Martin Petersson (Inactive)
            shkearns Shane Kearns
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes