Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websocket client object still available and 'OPEN' after remote connection killed. #886

Closed
evoisard opened this issue Apr 29, 2019 · 4 comments

Comments

@evoisard
Copy link

If a connect with a remote client (well, 127.0.0.1) to my websocket server and then I kill the remote client, the loss of connection isn't detected, my WebSocket client objet is still valid (e.g. getClient() not null) and in the OPEN state (isOpen() is true).

If I then do for example : ws.getClient().getRemoteSocketAddress() I get a NullPointerException.

With Wireshark, we can see that a TCP RST was sent to the server, which should have been handled.

I'd have expected the WebSocketServer to detect the TCP abort, an onError() or onClose() event to occur and isOpen() to report false.

  • Version used: 1.4.0
  • Java version: jdk-11.0.2
  • Operating System and version: Windows 10
@marci4
Copy link
Collaborator

marci4 commented Apr 29, 2019

Hello @evoisard,

we cannot do a lot when the underlying socket implementation does not report this abort.

Therefore we implemented the lost connection detection.

Hope this answers your question!

Best regards,
Marcel

@evoisard
Copy link
Author

evoisard commented May 3, 2019

Hi Marci,
Thanks for your reply.

I understand that the problem lays below in the socket implementation.
As we needed a faster reaction time when the connection fails and we wanted to avoid too much ping/pong traffic in the network by increasing the heartbeat pace, we based our connection sanity check on calls to getRemoteSocketAddress(). If that one returns null ("unconnected") on a previously working connection, we assume the connection is dead. It seems to work...

@marci4
Copy link
Collaborator

marci4 commented May 3, 2019

So I assume your question is answered then?

Best regards,
Marcel

@evoisard
Copy link
Author

evoisard commented May 3, 2019

Yes, We can close this issue, thanks.
Best regards, Eric

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants