Commit 6d007c7
Close test loops, drop dead walkers, fix misleading comments
Review follow-ups: resource hygiene in the poison-frame tests, dead code
left behind by the recovery fold, and comments that contradict the code.
Wrap the twelve CursorWebSocketSendLoops in
CursorWebSocketSendLoopPoisonFrameTest in try-with-resources. They were
never closed, and their enclosing bodies leaked on the assertion-failure
path too, which TestUtils.assertMemoryLeak hides because it calls
skipChecks() when the body throws. Nesting the loop inside the engine's
try-with-resources also fixes close order: the loop borrows the engine's
persisted dictionary prefix, so it must close first. A probe on all
twelve sites confirms none of them actually leaked -- no symbol-dict
mirror or catch-up frame buffer was allocated on these paths, and the
reconnect factory registers every client in the list closeAll() drains.
The value is in removing the trap: releaseSentDictBytes() and
freeCatchUpFrameBuffer() are reachable only through close(), so a future
test in one of these bodies that triggers a dictionary catch-up would
have leaked silently.
Carry the slot-qualified path into PersistedSymbolDict so the mmap-trim
warning in close() names the dictionary it is about. It logged the bare
FILE_NAME constant, which is unattributable in a process holding many
slots -- a foreground sender plus N orphan drainers.
Delete SegmentRing.findLastFsnWithoutPayloadFlag and
MmapSegment.findLastFrameFsnWithoutPayloadFlag. The recovery fold left
both without callers, and each walks the whole backlog. Drop the two
dead stores in RecoveredFrameAnalysis.finish(): only appendRaw() reads
those fields, and it cannot run after finish().
Correct four comments that state the opposite of what the code does:
- hasEverConnected is documented as observability only while being half
of endpointPolicyFailureIsTerminal().
- PersistedSymbolDict.close() claims that nulling the pointer prevents
use-after-free, contradicting loadedEntriesAddr()'s accurate javadoc.
It guards a construction-phase reader; ordering is what makes the
borrow safe across threads.
- sentDictBytesOwned describes borrowing as an orphan-only state, but
loops of either policy borrow now.
- connectWithDurableAckRetry refers to @testonly callers that no longer
exist.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent ba4d458 commit 6d007c7
7 files changed
Lines changed: 278 additions & 324 deletions
File tree
- core/src
- main/java/io/questdb/client/cutlass/qwp/client/sf/cursor
- test/java/io/questdb/client/test/cutlass/qwp/client/sf/cursor
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
| 270 | + | |
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
| |||
Lines changed: 10 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
302 | | - | |
303 | | - | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
304 | 306 | | |
305 | 307 | | |
306 | 308 | | |
| |||
373 | 375 | | |
374 | 376 | | |
375 | 377 | | |
376 | | - | |
377 | | - | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
378 | 384 | | |
379 | 385 | | |
380 | 386 | | |
| |||
Lines changed: 0 additions & 41 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
566 | 566 | | |
567 | 567 | | |
568 | 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 | 569 | | |
611 | 570 | | |
612 | 571 | | |
| |||
Lines changed: 17 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
175 | 180 | | |
176 | 181 | | |
177 | 182 | | |
| |||
209 | 214 | | |
210 | 215 | | |
211 | 216 | | |
| 217 | + | |
212 | 218 | | |
213 | 219 | | |
214 | 220 | | |
| |||
217 | 223 | | |
218 | 224 | | |
219 | 225 | | |
| 226 | + | |
220 | 227 | | |
221 | 228 | | |
222 | 229 | | |
| |||
510 | 517 | | |
511 | 518 | | |
512 | 519 | | |
513 | | - | |
514 | | - | |
515 | | - | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
516 | 527 | | |
517 | 528 | | |
518 | 529 | | |
| |||
533 | 544 | | |
534 | 545 | | |
535 | 546 | | |
536 | | - | |
| 547 | + | |
537 | 548 | | |
538 | 549 | | |
539 | 550 | | |
| |||
753 | 764 | | |
754 | 765 | | |
755 | 766 | | |
756 | | - | |
| 767 | + | |
757 | 768 | | |
758 | 769 | | |
759 | 770 | | |
| |||
921 | 932 | | |
922 | 933 | | |
923 | 934 | | |
924 | | - | |
| 935 | + | |
925 | 936 | | |
926 | 937 | | |
927 | 938 | | |
| |||
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
163 | | - | |
164 | 162 | | |
165 | 163 | | |
166 | 164 | | |
| |||
Lines changed: 0 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
656 | 656 | | |
657 | 657 | | |
658 | 658 | | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | | - | |
671 | | - | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | 659 | | |
689 | 660 | | |
690 | 661 | | |
| |||
0 commit comments