-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Version
5.0.5
Context
π Bug Report: Intermittent WebSocket Client Connection Eviction/Shutdown During Handshake
π― Version
- Vert.x Version: 5.0.5
- Operating System: macOS (Apple Silicon - M1)
- Java: 21
Java Version: OpenJDK 21
π Description
I'm encountering an issue where the **WebSocket client connection is being unexpectedly shut down (ShutdownEvent / Connection evicted) immediately after sending the WebSocket handshake request, and before receiving the server's handshake response. This issue occurs intermittently (occasionally), not on every attempt, but when it does, it prevents the WebSocket connection from being established. The client is connecting to a locally developed Vert.x WebSocket server.
β Expected Behavior
The WebSocket client should wait for the server's handshake response. If the response is valid, the connection should be upgraded to a WebSocket connection and stay active. The connection should not be shut down or evicted during the handshake phase unless explicitly requested or due to a network error/timeout.
β Actual Behavior
Intermittently, the connection is closed/evicted during the handshake phase, specifically after the handshake request is sent and before a response is received.
The log shows a USER_EVENT: io.vertx.core.net.impl.ShutdownEvent which leads to a Connection evicted warning and subsequent connection closure, as shown below:
... (Handshake Request WRITE/FLUSH occurs before this)
2025-12-05 16:25:21 DEBUG [vert.x-eventloop-thread-2] i.n.handler.logging.LoggingHandler - [id: 0xe82a509f, L:/127.0.0.1:55615 - R:localhost/127.0.0.1:47136] ACTIVE
2025-12-05 16:25:21 DEBUG [vert.x-eventloop-thread-2] i.n.handler.logging.LoggingHandler - [id: 0xbe1d97b4, L:/127.0.0.1:55615 - R:localhost/127.0.0.1:47136] USER_EVENT: io.vertx.core.net.impl.ShutdownEvent@4909845e
2025-12-05 16:25:21 WARN [vert.x-eventloop-thread-2] i.v.c.h.i.HttpClientConnectionInternal - Connection evicted
2025-12-05 16:25:21 DEBUG [vert.x-eventloop-thread-2] i.n.handler.logging.LoggingHandler - [id: 0xbe1d97b4, L:/127.0.0.1:55615 - R:localhost/127.0.0.1:47136] WRITE: 0B
2025-12-05 16:25:21 DEBUG [vert.x-eventloop-thread-2] i.n.handler.logging.LoggingHandler - [id: 0xbe1d97b4, L:/127.0.0.1:55615 - R:localhost/127.0.0.1:47136] FLUSH
2025-12-05 16:25:21 DEBUG [vert.x-eventloop-thread-2] i.n.handler.logging.LoggingHandler - [id: 0xbe1d97b4, L:/127.0.0.1:55615 - R:localhost/127.0.0.1:47136] CLOSE
2025-12-05 16:25:21 DEBUG [vert.x-eventloop-thread-2] i.n.handler.logging.LoggingHandler - [id: 0xbe1d97b4, L:/127.0.0.1:55615 ! R:localhost/127.0.0.1:47136] INACTIVE
Steps to reproduce
- Create Http Server with webSocketHandshakeHandler, webSocketHandler
- Use the
WebSocketClientto initiate a WebSocket connection. - The client sends the WebSocket handshake
GETrequest. - Immediately following the write/flush of the handshake request, a
ShutdownEventis processed on the connection, leading to an eviction.
Do you have a reproducer?
No response