Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Client timeout leads to unresponsive Qt SSL Websocket server



  • Hello,

    I discovered the following behaviour with the Qt SSL Websocket Server. The following example should be fully reproducible. I used OpenSSL to generate a self signed certificate. The problem only occurs with Google Chrome, because e.g. in IE I don't get the timeout message on the client after that time.

    .) Set up the official SSL Echo Server Example: http://doc.qt.io/qt-5/qtwebsockets-sslechoserver-example.html

    .) Replace the following SLOT method:

    #include <QThread>
    
    void SslEchoServer::processTextMessage(QString message)
    {
        QWebSocket *pClient = qobject_cast<QWebSocket *>(sender());
        if (pClient)
        {
            qDebug() << "Received";
            qDebug() << message;
    
            qDebug() << "Sleeping...";
            QThread::sleep(90);
            qDebug() << "Wake up...";
        }
    }
    

    .) Set up the following websocket client html page:

    http://doc.qt.io/qt-5/qtwebsockets-sslechoserver-sslechoclient-html.html

    .) Open this html site twice in your Google Chrome browser

    .) First Tab:

    Connect to the websocket server and send a "test" - message

    .) Move quickly to the second Tab and connect to the same websocket server, click "State"

    .) You should see the "Connecting"-state, which is okay, because the thread is in sleep-mode for 90 seconds
    After 30s Google Chrome returns a timeout error:

    ERROR: undefined
    DISCONNECTED

    After the thread wakes up in my case the websocket server is not responsive anymore, I can't establish a connection with any browser or client, so that I have to restart the entire application.

    Is this a bug or is there any setting to fix that issue?


Log in to reply