Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Client timeout leads to unresponsive Qt SSL Websocket server

Client timeout leads to unresponsive Qt SSL Websocket server

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 607 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hans Hupe
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved