Commit b2cf8a9
committed
[grid] Skip the TCP tunnel read-idle close when reads are paused
The read-idle close that TcpUpgradeTunnelHandler installs after the
tunnel is established (introduced by db9b07a, 2026-03-11,
"[grid] Router WebSocket handle dropped close frames, idle disconnects,
high-latency proxying", #17197) tears down both tunnel channels when no
bytes have been received for 120 seconds. That is the right behaviour
when an intermediate load balancer has silently dropped the TCP
connection, but it interacts badly with the backpressure mirroring
added in 5cf2e2a (2026-05-26, "[grid] Apply TCP backpressure across
the WebSocket tunnel handler", #17543): when the peer's outbound buffer
crosses its high-water mark, TcpTunnelHandler sets autoRead=false on
this side, no channelRead events fire, and the read-idle timer reaches
its threshold even though the stall is by design. A sustained slow
consumer for more than two minutes will therefore have the tunnel torn
down underneath it.
Gate the close in IdleCloseHandler.userEventTriggered on the channel's
autoRead flag: while reads are paused by backpressure, log at FINE and
ignore the event. As soon as the peer drains and TcpTunnelHandler
restores autoRead=true the read-idle clock starts again from a fresh
read, so a legitimately dropped connection is still detected within
the same window once traffic resumes.
IdleCloseHandler is promoted from a private nested class to
package-private so a focused EmbeddedChannel unit test can exercise
both branches: the close-both-channels behaviour on a normal idle
event, and the ignored-while-paused behaviour with autoRead=false.1 parent 83b0c35 commit b2cf8a9
3 files changed
Lines changed: 71 additions & 1 deletion
File tree
- java
- src/org/openqa/selenium/netty/server
- test/org/openqa/selenium/netty/server
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
382 | | - | |
| 382 | + | |
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
| |||
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
393 | 405 | | |
394 | 406 | | |
395 | 407 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
Lines changed: 56 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
0 commit comments