Vert.x 3.9.3: WebSocket closeHandler no longer sending close frames

227 views
Skip to first unread message

Wayne Morrison

unread,
Sep 22, 2020, 6:30:18 AM9/22/20
to vert.x
Hi, just a quick question around changes made in Vert.x 3.9.3 around websocket close handling. 

In Vert.x 3.9.2, closing a websocket would result in a close frame being sent to the client (to instruct it to close). With version 3.9.3, this code seems to have changed significantly and the close mechanism is now propagated to the client by just closing the websocket connection (or channel).

Question: Is it expected then that a close frame is no longer sent on server close?

For wider context: As part of our product, we test proxying websocket data from a Vert.x client to a Vert.x server but not using a Vert.x websocket proxy. Previously, when frames were used, the server close message was propagated by the proxy to the client. With version 3.9.3, the proxy receives the connection/ channel close but does not propagate it to the client. The best it can do is close its own websocket connection to the client (not as straightforward as you'd expect if the proxy is running in a Tomcat instance).

Thanks, Wayne

Wayne Morrison

unread,
Sep 22, 2020, 7:18:26 AM9/22/20
to vert.x
Sorry, to clarify:

In our test we DO NOT call `ServerWebSocket.close()` , instead we close the underlying HttpServer.

Julien Viet

unread,
Sep 22, 2020, 2:28:28 PM9/22/20
to vert.x
Hi Wayne,

we did some changes in the WebSocket closing handshake (https://github.com/eclipse-vertx/vert.x/issues/3531)

Previously when the server WebSocket was closed it was sending a close frame and closing the socket immediately.

Now when the server WebSocket is closed, it sends a close frame and wait for the client to echo this close frame, when this close frame is received then the socket is closed.

I just checked with 3.9.3 and a regular server close and this is what is happening (I double checked with Wireshark).

Can you provide a reproducer so we can have a look at it ?

Julien

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/4db2ff63-d0af-454a-9f16-72665acf1c8cn%40googlegroups.com.

Julien Viet

unread,
Sep 22, 2020, 2:29:45 PM9/22/20
to vert.x
So what you are observing is that when WebSocket are closed by a server shutdown then the socket are closed abruptly without sending a close frame and before it was sending them ?

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.

Wayne Morrison

unread,
Sep 23, 2020, 6:16:29 AM9/23/20
to vert.x
Hi Julien, thanks for the info. The point in your second response is correct. 

When we do an abrupt server close (in our test), we don't see a close frame being sent (in either direction). We only see the disconnect (FIN).

By abrupt server close, I mean:
    httpServer.close();

Please see the attached images taken from WireShark, showing the relevant comms between the client -> proxy -> server:
- proxy-392.jpg shows the comms using Vert.x 3.9.2 - and clearly shows the websocket close frames being sent prior to the FIN (commencing at packet no 15850).
- proxy-393.jpg shows the comms using Vert.x 3.9.3 - and shows only the connection closure (FIN - beginning with packet no 207):

The proxy is sitting on port 8787 and just passes messages received backwards and forwards between the client and server.
The server is sitting on port 7878.

Please let me know if you would like a reproducer.

Kind regards, Wayne
proxy-392.jpg
proxy-393.jpg

Julien Viet

unread,
Sep 23, 2020, 10:15:31 AM9/23/20
to vert.x
Hi,

can you open an issue for this ?

I think the reproducer should be fairly easy to do, so I'll ask for one if needed.

thanks

Julien


Wayne Morrison

unread,
Sep 23, 2020, 11:00:13 AM9/23/20
to vert.x
Sure, willdo. Thanks for your time...

Let us know if you need the reproducer.

Cheers, Wayne

Wayne Morrison

unread,
Sep 23, 2020, 11:49:02 AM9/23/20
to vert.x
Reply all
Reply to author
Forward
0 new messages