Commit ca1f60f
Retry flaky Vert.x WebSocket server tests (#5410)
## Problem
The Vert.x WebSocket server tests (`CatsVertxServerTest`,
`ZioVertxServerTest`, `VertxServerTest`) intermittently fail CI with a
3-minute `TimeoutException` — e.g. recently on scala-steward dependency
PRs (#5404), unrelated to the bumped dependency.
## Root cause (upstream Vert.x, not tapir)
A race in `HttpServerRequest.toWebSocket()`: Vert.x writes+flushes the
HTTP 101 in one event-loop task and completes the returned `Future`
(where we register our frame handler) in a later task. A client frame
arriving in that ~1-3 ms window is read and then **silently dropped** —
`WebSocketImplBase.receiveFrame` discards TEXT/BINARY frames when no
handler is registered, and the server WebSocket's inbound queue starts
unpaused. The echo never returns, so the test times out.
This is **not fixable via Vert.x's public per-request API**:
`toWebSocket()` hands back an already-flowing socket, and the
intermediate handshake object isn't exposed (its `pause()` throws
`UnsupportedOperationException`). The only race-free API is the
server-level `HttpServer.webSocketHandler`, which bypasses tapir's
`Router`. The bug is present in every released Vert.x and on current
`master`; it will be reported upstream (the fix there is to start the
server WebSocket paused / buffer inbound frames until a handler is
registered).
## This change
Interim, test-only: retry failed Vert.x server tests using the same
`withFixture` retry already used by `JdkHttpServerTest` and
`ZioHttpServerTest`. `retries = 3` (lower than those suites' `5`,
because a WS flake hangs ~3 min per attempt rather than failing fast).
Each attempt re-runs with a fresh timeout budget. No production code
changes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 504091b commit ca1f60f
6 files changed
Lines changed: 42 additions & 35 deletions
File tree
- server
- jdkhttp-server/src/test/scala/sttp/tapir/server/jdkhttp
- vertx-server
- cats/src/test/scala/sttp/tapir/server/vertx/cats
- src/test/scala/sttp/tapir/server/vertx
- zio/src/test/scala/sttp/tapir/server/vertx/zio
- zio-http-server/src/test/scala/sttp/tapir/server/ziohttp
- tests/src/main/scalajvm/sttp/tapir/tests
Lines changed: 2 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
15 | 13 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 14 | + | |
30 | 15 | | |
31 | 16 | | |
32 | 17 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
17 | 24 | | |
18 | 25 | | |
19 | 26 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
19 | 26 | | |
20 | 27 | | |
21 | 28 | | |
| |||
Lines changed: 1 addition & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
| |||
46 | 44 | | |
47 | 45 | | |
48 | 46 | | |
49 | | - | |
50 | 47 | | |
51 | 48 | | |
52 | 49 | | |
| |||
58 | 55 | | |
59 | 56 | | |
60 | 57 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
| 58 | + | |
75 | 59 | | |
76 | 60 | | |
77 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
| 8 | + | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
16 | 34 | | |
17 | 35 | | |
18 | 36 | | |
| |||
0 commit comments