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

QWebSocket doesn't disconnect properly in some situations (doesn't emit disconnected() signal)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.4.1
    • WebSockets
    • None
    • Windows 7 Profesional 64-bit
      Qt_5_4_1_MSVC2010_OpenGL_32bit-Release
      Google Chrome Version 43.0.2357.65 m

      To reproduce this bug:
      0) You need two computers: one for WebSocket server, and one for WebSocket client. Client should connect to server via WiFi. There should be another WiFi accesible for the client.
      1) Modify Echo Server example (http://doc.qt.io/qt-5/qtwebsockets-echoserver-example.html) to keep connection after sending echo message (to don't disconnect client automatically).
      2) Connect to Echo Server with simple Chrome JavaScript client.
      3) Play around with echo messages
      4) Close the browser. This should work fine, Echo Server's QWebSocket should emit the disconnected() signal. The debug message should be printed.
      5) Open client once again. Connect to Echo Server.
      6) Play around with echo messages
      7) Change your WiFi network.
      8) Client (browser) will disconnect, but QWebSocket will not. No disconnected() signal will be emitted, no debug message will be printed.

      Maybe switching from WiFi to LAN will also give the same effect.

      ------------

      EDIT

      I did more tests. No stateChanged() signal is emitted. No error() signal is emitted. socket remains valid (isValid() method).

      --------------

      EDIT 2

      If i try to ping (QWebSocket::ping(...)) this zombie socket, I get a seg fault.

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

            kurt.pattyn Kurt Pattyn
            stanislaw@wdidevice.com Stan Chlebicki
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes