Repository navigation
Commit 53ac21e
ci: tail-read hung_check.log instead of loading the full file
Address the bot review on #103551:
> Reading the whole `hung_check.log` here can allocate a lot of memory
> exactly on deadlock cases, where this file may be very large (full
> processlist + multiple `gdb` backtraces). Since we only need the last
> 32 KiB, please read just the tail (seek from end and decode that
> chunk) instead of `read_text` on the full file.
The previous version called `Path.read_text` which loads the entire
file into memory. On a real stress-test deadlock the log can grow into
the tens or hundreds of MiB once the processlist of every hung query
and the `gdb` backtrace of every server process are included, and the
machine is already under memory pressure.
Switch to a bounded tail read: open in binary mode, `seek` to
`max(0, size - 32 KiB)`, read the remaining bytes, decode with
`errors="replace"`. When the file did not fit in the budget, drop the
likely-partial first line so the tail always starts on a line
boundary, then prepend the existing truncation header. Successful
parsing of the resulting `test_results.tsv` row was verified end-to-
end against the same decoder used by `process_results` (tab/newline
escape round-trip), for empty / 1 KiB / 30 KiB / 40 KiB / 250 KiB /
5 MiB synthetic logs.
Behavior on the success branch and the small-file path is unchanged;
only the resource profile of the failure path is improved.
Session: cron:clickhouse-ci-task-worker:20260426-161500
Co-Authored-By: Claude Opus 4.7 <[email protected]>1 parent c445d07 commit 53ac21e
1 file changed
Lines changed: 26 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
647 | 647 | | |
648 | 648 | | |
649 | 649 | | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
650 | 659 | | |
651 | 660 | | |
652 | | - | |
653 | | - | |
654 | | - | |
655 | | - | |
656 | | - | |
657 | | - | |
658 | | - | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
659 | 675 | | |
660 | | - | |
661 | | - | |
662 | | - | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
663 | 679 | | |
664 | 680 | | |
665 | 681 | | |
| |||
0 commit comments