4.0.0.Beta3 - 4.0.0
Version 3.X.Y, 4.0.0.Beta1 and 4.0.0.Beta2 are not effected.
Since vert.x stack version 4.0.0.Beta3 SockJS websocket connections are not established
for load-balanced verticles until the same verticle processes the initial sockjs "/info" request and the websocket upgrade.
After the first successful websocket upgrade the problem vanishes.
This only occurs in combination with clustered sessions handled by an infinispan cluster manager and forced websocket connections.
I have not found the root cause for this problem.
Yes, it also includes a more detailed analysis of the problem:
vertx-4-infinispan-ws-sockjs-reproducer
See vertx-4-infinispan-ws-sockjs-reproducer
OS version, JVM version:
MacOS 10.15.7, AdoptOpenJDK 11 (build 11.0.9.1+1)
I've found the cause of this issue. In the session handler implementation, there's an async operation:
In Vert.x 4, it is now mandatory to pause the request before doing such operations if you want to be able to manage things like connection upgrades in route handlers coming next.
The reason is if you don't, the upgrade fails with "Request has already been read."
The authentication handler does it well:
I'll make the fix early next week, it should be ready for 4.0.1.
@tsegismont Thanks so much for sharing a solution. I've spent hours trying to migrate an auth handler to v4, when I finally came across this issue. 馃憤
Most helpful comment
I've found the cause of this issue. In the session handler implementation, there's an async operation:
https://github.com/vert-x3/vertx-web/blob/197f6164eefe7412d83777b70102becf7bcb2954/vertx-web/src/main/java/io/vertx/ext/web/handler/impl/SessionHandlerImpl.java#L284
In Vert.x 4, it is now mandatory to pause the request before doing such operations if you want to be able to manage things like connection upgrades in route handlers coming next.
The reason is if you don't, the upgrade fails with "Request has already been read."
The authentication handler does it well:
https://github.com/vert-x3/vertx-web/blob/3bba7ac26793a509c3f52844464b55f542206c9b/vertx-web/src/main/java/io/vertx/ext/web/handler/impl/AuthenticationHandlerImpl.java#L71-L78
I'll make the fix early next week, it should be ready for 4.0.1.