Commit cf3152d
fix(ilp): fail fast on fatal SF errors instead of looping
Three correctness fixes from a follow-up review of the QWiP store-and-
forward client. Each is paired with a regression test that fails on the
unfixed code and passes after the change.
Critical:
- WebSocketSendQueue.retryStalled split its catch ladder so a fatal
SfException during stall-retry (corruption, oversized frame, fsync
EIO) is classified the same as the main-loop sendBatch catch:
failConnection(_, true) terminal, not (_, false) reconnect. The old
behaviour silently reconnected and recycled the buffer as if sent,
hiding storage failures and risking infinite loops on persistent
errors. (C1)
- SegmentLog.createActive registers the freshly-opened fd into the
Segment before calling allocNativePath, and the try block now wraps
the path-allocation call. The catch closes the fd and best-effort
removes the orphan .sfa file. The previous order leaked one fd per
failed rotation under OOM pressure. (C2)
- ResponseHandler.onBinaryMessage error branch now fails the connection
fatally. A server-side per-batch error (parse, schema mismatch, write,
security, internal) is a protocol-level rejection of specific bytes;
reconnecting and re-sending the same payload produces the same error.
Under SF the rejected frame sits on disk and replay-on-reconnect
shipped it again, so the previous transient classification turned any
poisoned frame into an unbounded reconnect loop. (C4)
Infrastructure:
- FilesFacade gains allocNativePath / freeNativePath. SegmentLog now
routes all path-pointer alloc/free through the facade so tests can
inject OOM at the exact moment between openCleanRW and the try block
in createActive. Required for the C2 regression test.
Tests:
- testCreateActiveDoesNotLeakFdOnAllocNativePathOom (SegmentLogTest)
- testRetryStalledTreatsSfStorageErrorAsTerminal (SfIntegrationTest)
- testPoisonedFrameInSfDoesNotLoopForever (SfIntegrationTest)
- Full suite: 1971 tests pass (was 1968), zero regressions.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent efbd8e1 commit cf3152d
6 files changed
Lines changed: 629 additions & 17 deletions
File tree
- core/src
- main/java/io/questdb/client
- cutlass/qwp/client
- sf
- std
- test/java/io/questdb/client/test/cutlass/qwp/client/sf
Lines changed: 23 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
970 | 970 | | |
971 | 971 | | |
972 | 972 | | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
973 | 984 | | |
974 | | - | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
975 | 988 | | |
976 | 989 | | |
977 | 990 | | |
| |||
1165 | 1178 | | |
1166 | 1179 | | |
1167 | 1180 | | |
1168 | | - | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
1169 | 1189 | | |
1170 | 1190 | | |
1171 | 1191 | | |
1172 | 1192 | | |
1173 | 1193 | | |
1174 | 1194 | | |
1175 | 1195 | | |
1176 | | - | |
| 1196 | + | |
1177 | 1197 | | |
1178 | 1198 | | |
1179 | 1199 | | |
| |||
Lines changed: 25 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
| 278 | + | |
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
333 | | - | |
| 333 | + | |
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
| |||
555 | 555 | | |
556 | 556 | | |
557 | 557 | | |
558 | | - | |
| 558 | + | |
559 | 559 | | |
560 | 560 | | |
561 | 561 | | |
| |||
567 | 567 | | |
568 | 568 | | |
569 | 569 | | |
570 | | - | |
| 570 | + | |
571 | 571 | | |
572 | | - | |
| 572 | + | |
573 | 573 | | |
574 | 574 | | |
575 | 575 | | |
| |||
581 | 581 | | |
582 | 582 | | |
583 | 583 | | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
584 | 589 | | |
585 | 590 | | |
586 | 591 | | |
587 | | - | |
588 | 592 | | |
589 | 593 | | |
590 | 594 | | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | 595 | | |
| 596 | + | |
596 | 597 | | |
597 | 598 | | |
598 | 599 | | |
| |||
601 | 602 | | |
602 | 603 | | |
603 | 604 | | |
604 | | - | |
605 | | - | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
606 | 617 | | |
607 | 618 | | |
608 | 619 | | |
| |||
698 | 709 | | |
699 | 710 | | |
700 | 711 | | |
701 | | - | |
| 712 | + | |
702 | 713 | | |
703 | 714 | | |
704 | 715 | | |
| |||
712 | 723 | | |
713 | 724 | | |
714 | 725 | | |
715 | | - | |
| 726 | + | |
716 | 727 | | |
717 | 728 | | |
718 | 729 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
34 | 39 | | |
35 | 40 | | |
36 | 41 | | |
| |||
66 | 71 | | |
67 | 72 | | |
68 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
69 | 79 | | |
70 | 80 | | |
71 | 81 | | |
| |||
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
38 | 47 | | |
39 | 48 | | |
40 | 49 | | |
| |||
49 | 58 | | |
50 | 59 | | |
51 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
52 | 67 | | |
53 | 68 | | |
54 | 69 | | |
| |||
Lines changed: 113 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
564 | 565 | | |
565 | 566 | | |
566 | 567 | | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
567 | 640 | | |
568 | 641 | | |
569 | 642 | | |
| |||
947 | 1020 | | |
948 | 1021 | | |
949 | 1022 | | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
950 | 1038 | | |
951 | 1039 | | |
952 | 1040 | | |
| |||
987 | 1075 | | |
988 | 1076 | | |
989 | 1077 | | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
990 | 1083 | | |
991 | 1084 | | |
992 | 1085 | | |
| |||
1069 | 1162 | | |
1070 | 1163 | | |
1071 | 1164 | | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
1072 | 1170 | | |
1073 | 1171 | | |
1074 | 1172 | | |
| |||
1104 | 1202 | | |
1105 | 1203 | | |
1106 | 1204 | | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
1107 | 1210 | | |
1108 | 1211 | | |
1109 | 1212 | | |
| |||
1181 | 1284 | | |
1182 | 1285 | | |
1183 | 1286 | | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
1184 | 1292 | | |
1185 | 1293 | | |
1186 | 1294 | | |
| |||
1216 | 1324 | | |
1217 | 1325 | | |
1218 | 1326 | | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
1219 | 1332 | | |
1220 | 1333 | | |
1221 | 1334 | | |
| |||
0 commit comments