Commit cba62ac
committed
fix(qwp): pace transient close recycles + minimum poison-escalation dwell
The poison-frame detector could turn a TRANSIENT, post-connect outage into a
producer-fatal PROTOCOL_VIOLATION -- the exact false-positive its design
contract forbids ("a genuine outage fails at connect, not deterministically on
one FSN"). A middlebox/LB that completes the WS upgrade, accepts the head frame,
then non-orderly-closes (1006/1011) while its backend is briefly down succeeds
at CONNECT every cycle, so connectLoop's failed-connect backoff never engages.
Two gaps let that latch a terminal:
1. Below the strike threshold, onClose recycled through the UNPACED fail() --
unlike the NACK path, which uses failPaced(). Strikes then accrued at
connect+send+close RTT rate (well under a second) with no widening gaps.
Fix: route the below-threshold non-orderly-close strike through the same
strike-escalated failPaced the NACK path uses; genuine transport closes
(orderly, or before any send) still reconnect immediately via fail().
2. Escalation fired on strike count alone, so even with pacing a brief outage
(longer than the ~sub-second strike window) still escalated. Fix: gate
escalation on a minimum wall-clock dwell -- poisonStrikes >= threshold AND
the suspect has stayed poisoned for at least poison_min_escalation_window_
millis (default 5000ms). This decouples "how many strikes prove determinism"
from "how long a transient is allowed to look poisoned"; an OK at/beyond the
suspect during the window resets the detector. 0 = legacy immediate
escalation at the threshold.
The dwell is first-class config, mirroring max_frame_rejections end-to-end:
connect-string key poison_min_escalation_window_millis (ConfigSchema INGRESS),
LineSenderBuilder.poisonMinEscalationWindowMillis(long), forwarded to the cursor
send loop and every BackgroundDrainer. The raw CursorWebSocketSendLoop
constructor overloads default the dwell to 0 (legacy) so existing tests keep
exact escalate-at-N semantics; the 5s user default is applied at the config
layer, same split max_frame_rejections uses.
Tests (CursorWebSocketSendLoopPoisonFrameTest):
- testNonOrderlyCloseRecycleIsPacedAgainstAcceptingMiddlebox: real I/O thread;
unpaced code records ~200k recycles/1.2s, paced <=10. Proven red->green.
- testPoisonDwellHoldsEscalationUntilWallClockWindowElapses: strikes past the
threshold must not escalate until the window elapses. Proven red->green.
- ServerErrorAckTerminalTest escalation tests set
poison_min_escalation_window_millis=0 so exact per-strike counts stay
assertable; WsSenderConfigHonoredTest pins the new key end-to-end.1 parent c10a582 commit cba62ac
8 files changed
Lines changed: 352 additions & 19 deletions
File tree
- core/src
- main/java/io/questdb/client
- cutlass/qwp/client
- sf/cursor
- impl
- test/java/io/questdb/client/test
- cutlass/qwp/client
- sf/cursor
- impl
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1050 | 1050 | | |
1051 | 1051 | | |
1052 | 1052 | | |
| 1053 | + | |
1053 | 1054 | | |
1054 | 1055 | | |
1055 | 1056 | | |
| |||
1501 | 1502 | | |
1502 | 1503 | | |
1503 | 1504 | | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
1504 | 1508 | | |
1505 | 1509 | | |
1506 | 1510 | | |
| |||
1573 | 1577 | | |
1574 | 1578 | | |
1575 | 1579 | | |
1576 | | - | |
| 1580 | + | |
| 1581 | + | |
1577 | 1582 | | |
1578 | 1583 | | |
1579 | 1584 | | |
| |||
2443 | 2448 | | |
2444 | 2449 | | |
2445 | 2450 | | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
2446 | 2475 | | |
2447 | 2476 | | |
2448 | 2477 | | |
| |||
3378 | 3407 | | |
3379 | 3408 | | |
3380 | 3409 | | |
| 3410 | + | |
| 3411 | + | |
| 3412 | + | |
| 3413 | + | |
| 3414 | + | |
| 3415 | + | |
3381 | 3416 | | |
3382 | 3417 | | |
3383 | 3418 | | |
| |||
3646 | 3681 | | |
3647 | 3682 | | |
3648 | 3683 | | |
| 3684 | + | |
| 3685 | + | |
| 3686 | + | |
3649 | 3687 | | |
3650 | 3688 | | |
3651 | 3689 | | |
| |||
3821 | 3859 | | |
3822 | 3860 | | |
3823 | 3861 | | |
| 3862 | + | |
3824 | 3863 | | |
3825 | 3864 | | |
3826 | 3865 | | |
| |||
Lines changed: 13 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
287 | 291 | | |
288 | 292 | | |
289 | 293 | | |
| |||
655 | 659 | | |
656 | 660 | | |
657 | 661 | | |
658 | | - | |
| 662 | + | |
| 663 | + | |
659 | 664 | | |
660 | 665 | | |
661 | 666 | | |
| |||
685 | 690 | | |
686 | 691 | | |
687 | 692 | | |
688 | | - | |
| 693 | + | |
| 694 | + | |
689 | 695 | | |
690 | 696 | | |
691 | 697 | | |
| |||
702 | 708 | | |
703 | 709 | | |
704 | 710 | | |
| 711 | + | |
705 | 712 | | |
706 | 713 | | |
707 | 714 | | |
| |||
2353 | 2360 | | |
2354 | 2361 | | |
2355 | 2362 | | |
2356 | | - | |
| 2363 | + | |
| 2364 | + | |
2357 | 2365 | | |
2358 | 2366 | | |
2359 | 2367 | | |
| |||
3211 | 3219 | | |
3212 | 3220 | | |
3213 | 3221 | | |
3214 | | - | |
| 3222 | + | |
| 3223 | + | |
3215 | 3224 | | |
3216 | 3225 | | |
3217 | 3226 | | |
| |||
Lines changed: 12 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
132 | 135 | | |
133 | 136 | | |
134 | 137 | | |
| |||
145 | 148 | | |
146 | 149 | | |
147 | 150 | | |
148 | | - | |
| 151 | + | |
| 152 | + | |
149 | 153 | | |
150 | 154 | | |
151 | 155 | | |
| |||
164 | 168 | | |
165 | 169 | | |
166 | 170 | | |
167 | | - | |
| 171 | + | |
| 172 | + | |
168 | 173 | | |
169 | 174 | | |
170 | 175 | | |
| |||
176 | 181 | | |
177 | 182 | | |
178 | 183 | | |
| 184 | + | |
179 | 185 | | |
180 | 186 | | |
181 | 187 | | |
| |||
187 | 193 | | |
188 | 194 | | |
189 | 195 | | |
190 | | - | |
| 196 | + | |
| 197 | + | |
191 | 198 | | |
192 | 199 | | |
193 | 200 | | |
| |||
567 | 574 | | |
568 | 575 | | |
569 | 576 | | |
570 | | - | |
| 577 | + | |
| 578 | + | |
571 | 579 | | |
572 | 580 | | |
573 | 581 | | |
| |||
0 commit comments