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

Race condition when multiple network requests are open, and the remote socket is closed prematurely

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.6.0 RC
    • 5.5.1
    • Network: HTTP
    • None
    • Windows 7, MSVC 2013 32 bit
    • 0df5d079290b4c3b13e58e9397fabdc1dfdba96b

    Description

      If a remote host closes the socket prematurely in the handshaking phase it can happen that the state of some QNetworkRequest's is not updated to RemoteHostClosed. Instead, QHttpNetworkConnectionChannel tries to send a request, resulting in a qwarning:

      QIODevice::write (QTcpSocket): device not open [spurious]
      

      Stack trace for the warning:

      0	QIODevice::write	qiodevice.cpp	1289	0x50ff6ee5	
      1	QIODevice::write	qiodevice.h	117	0x50e66773	
      2	QHttpProtocolHandler::sendRequest	qhttpprotocolhandler.cpp	319	0x50c5d08f	
      3	QHttpNetworkConnectionChannel::sendRequest	qhttpnetworkconnectionchannel.cpp	212	0x50c56393	
      4	QHttpNetworkConnectionChannel::_q_connected	qhttpnetworkconnectionchannel.cpp	792	0x50c58281	
      5	QHttpNetworkConnectionChannel::qt_static_metacall	moc_qhttpnetworkconnectionchannel_p.cpp	126	0x50c55321	
      6	QMetaObject::activate	qobject.cpp	3713	0x5113b189	
      7	QMetaObject::activate	qobject.cpp	3578	0x5113abd1	
      8	QAbstractSocket::connected	moc_qabstractsocket.cpp	367	0x50cf6d7a	
      9	QAbstractSocketPrivate::fetchConnectionParameters	qabstractsocket.cpp	1327	0x50cf95b3	
      10	QAbstractSocketPrivate::_q_testConnection	qabstractsocket.cpp	1181	0x50cf8a91	
      11	QAbstractSocketPrivate::connectionNotification	qabstractsocket.cpp	845	0x50cf7bbb	
      12	QAbstractSocketEngine::connectionNotification	qabstractsocketengine.cpp	177	0x50ce562a	
      13	QNativeSocketEngine::connectionNotification	qnativesocketengine.cpp	562	0x50d03baf	
      14	QWriteNotifier::event	qnativesocketengine.cpp	1203	0x50d044a0	
      15	QCoreApplicationPrivate::notify_helper	qcoreapplication.cpp	1094	0x510f9d2e	
      16	QCoreApplication::notify	qcoreapplication.cpp	1038	0x510f82b3	
      17	QCoreApplication::notifyInternal	qcoreapplication.cpp	965	0x510f9407	
      18	QCoreApplication::sendEvent	qcoreapplication.h	224	0x51101c59	
      19	qt_internal_proc	qeventdispatcher_win.cpp	398	0x51189b71	
      ...	<Mehr>				
      

      Attached example demonstrates the issue.

      Attachments

        Issue Links

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

          Activity

            People

              ulherman Ulf Hermann
              kkohne Kai Köhne
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes