TooTallNate / Java-WebSocket

A barebones WebSocket client and server implementation written in 100% Java.
http://tootallnate.github.io/Java-WebSocket
MIT License
10.47k stars 2.57k forks source link

(QNX + Azul JVM) When clients is re-connecting to WebSocket server there will be delay on handshake #1333

Closed artado closed 10 months ago

artado commented 1 year ago

Description When clients is re-connecting to my WebSocket server there will be delay of "connectionLostTimeout" until handshake will be responded to client. Please let me know if you have any suggestions.

To Reproduce Steps to reproduce the behavior:

  1. Test WebSocket client is connecting to server, handshake is initiated within milliseconds
  2. When I disconnect the client and immediately reconnect it the connection will be established within the timeframe of connectionLostTimeout

Please note: when I change the WebSocketServer connectionLostTimeout parameter to something a lot smaller than default 60 seconds (e.g. 2 seconds) -- re-connection & handshake will happen within a timeframe of a new connectionLostTimeout (e.g. 2 seconds). However in this case I risk to break the connection by Server side.

You can see the same in Wireshark log: image

Example application to reproduce the issue

    MyWebSocketServer server;
    public void doStartServer(){
        server = new MyWebSocketServer(getPort());
        server.start();
    }

    public void doStopServer(){
        try {
            server.stop();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}

public class MyWebSocketServer extends WebSocketServer {
    public MyWebSocketServer(int port) {
        super(new InetSocketAddress(port));
    }
}

Expected behavior Expected that it will reconnect immediately.

Environment: Please note that this is running on embedded hardware, I do not have the same problem running the code on Linux or Windows.

PhilipRoman commented 1 year ago

I have to say - I have no idea how to even start debugging this. If you can provide step by step instructions how to set up an environment with QNX and Azul JVM (or at least one of them so we can check which one is causing the issue), I can look into it.

PhilipRoman commented 10 months ago

Closing as I do not have a way to reproduce. If there is any update, let me know.