Repository navigation
Conversation
Internal second-model review (5 rounds, final gate clean)An independent model reviewed the diff cold each round; a reviewer separate from the author ❌ The wrapper test proved the row but not the shell contract (raised 3 rounds, fixed) ❌ The escaping caveat named the wrong class (fixed in the description)
💡 Three hunks reformat neighbouring test functions ( Session id: cron:clickhouse-review-slot-11:20260809-101900 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-40:20260809-092900 |
|
cc @maxknv, could you review this? The stress and upgrade wrappers only wrote |
|
Workflow [PR], commit [27c390e] Summary: ❌
AI ReviewSummaryThe PR moves the stress/upgrade script-output capture into shared helpers, mirrors the captured output back to the console without reintroducing the inherited-stdout hang, and appends the failure reason into the parsed Final Verdict✅ No new findings. |
|
|
||
| import os | ||
| import re | ||
| import shutil |
There was a problem hiding this comment.
Removed in c609339. ci/tests/test_stress_job.py is byte-identical to master again, so this PR is
three shell files.
One consequence worth stating: those arms were the only thing pinning the wrapper contract. With them
gone, inverting the exit-code comparison or sending tee to /dev/null leaves the suite green - I
checked both as mutants rather than assuming it. The measurements themselves are unaffected and stay
in the PR description, now marked as evidence from 1323f8d rather than as coverage this branch
ships.
If you would rather keep the contract pinned in a different shape, say where and I will add it.
Otherwise it stays out.
There was a problem hiding this comment.
I would leave ci/tests/test_stress_job.py out. The diff is back to shell-only, and the remaining concern is in the wrapper's parent-bound capture rather than in read_test_results, so reviving that removed Python harness would not close it.
|
@groeneai resolve the merge conflicts |
|
Resolved in Verified by running the resolved block with a stub stress.py: the stub receives |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units416 translation units recompiled, 3542 s compile time in total, 416 of them have a recent master baseline. |
CI finish ledger - 25177bbEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Notes on the two non-mine rows, so the attribution is checkable:
The amd_tsan row is worth one extra line because it was mine and it was new: Session id: cron:clickhouse-maint-slot-19:20260810-161502 |
|
Fixing PR for the I had left it as a fix task because the STID did not match the one #113397 was attached to. It is the
The three buckets carry the same cycle; the controls carry none of it, so the frame test This branch changes three shell files under |
`Stress test (*)` and `Upgrade check (*)` never redirected the stress script's output, so it reached only the job console and `test_results.tsv` recorded the exit status alone. In the 30 days to 2026-08-09 all 152 `Test script failed` rows carried a byte-identical ` script exit code: 1`, so the family could not be triaged from the CI database; reading three of those job logs gave two unrelated causes. The script is now redirected to a capture outside `/test_output`, which is uploaded wholesale, and mirrored to the console with `tail --pid`. It is not piped: `prepare_for_hung_check` drops databases with a fire-and-forget `Popen(..., shell=True)` that inherits the wrapper's stdout, and a pipe reader waits for those clients long after the script exits, which timed the job out at 10800 s. The exit code is `$?` after `wait`, and the tail of the capture goes into the `info` cell of the row the wrapper already emitted. Those clients can also append after the script exits while the mirror ends with it, so the wrapper waits for the capture to stop growing and then prints the bytes the mirror missed. The wait is a bounded size poll rather than a wait on the descriptor, since that is what deadlocked the pipe form, and the flush offset is the mirror's own byte count because the file size afterwards can already include unmirrored bytes. `escaped()` pre-compensates its row terminator for `echo -e`, which collapses one escape level, so a `printf '%s'` caller would get a backslash before every decoded newline. `escaped_tail()` is its single-level sibling and `escaped()` is untouched. The reader decodes `\t`, `\r` and `\n` only, so a byte the `Escaped` rule encodes but it does not keeps a visible backslash; ClickHouse#113857 makes the codec reversible. This fixes visibility, not the trigger. Related: ClickHouse#113857 Co-Authored-By: Claude Fable 5 <[email protected]>
f083090 to
ac22635
Compare
The wrapped script leaves clients holding its stdout, so the capture keeps growing after the script exits. The settle wait bounds how long the result row waits for that, which is deliberate: waiting on the descriptor is what timed the job out at 10800 s before the wrapper stopped using a pipe. But once the wait gave up, the remaining bytes were only in /tmp/stress_script.log, which is outside /test_output and is not collected, so they reached neither the console nor the artifacts. Master piped the script straight to the job log and therefore printed that output at any delay, so this was a regression against it rather than a pre-existing gap. The wrapper now looks at the capture once more when the job ends, from an EXIT trap so that an epilogue command failing under errexit, the post-stress start_server failure and the upgrade allow-list exit are all covered. Whatever arrived since the row was composed goes to the console, and a failing run keeps the capture next to the other artifacts. flush_capture reports where it stopped and finalize_capture advances that offset, so no byte is printed twice. Nothing in the trap may fail: a failure inside a trap body under errexit would replace the status the job reports, which is why a failed preservation warns instead of returning non-zero. Measured on both runners with a parent exiting 1 after spawning a child that prints later. Console and artifact keep a 20 s and a 30 s line where the previous head lost both, including on an epilogue that aborts before its last line, and master's console keeps it at every delay. An immortal descriptor holder still finishes in seconds rather than hanging, a passing run gains no artifact, no line is printed twice, and exit codes 0/1/42/143 are unchanged with an empty capture, a non-empty capture and an unwritable artifact directory. Co-Authored-By: Claude Fable 5 <[email protected]>
CI finish ledger — a00d437Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20260812-113000 |
…on one client timeout The stress harness died before any stress testing started: in `install_thread_pool_fault_injection`, the verify query `SELECT value FROM system.server_settings WHERE name = 'cannot_allocate_thread_fault_injection_probability'` hit the client's 15 s `receive_timeout` right after `SYSTEM RELOAD CONFIG` and the single `check_output` call took the whole job down with "Test script failed, script exit code: 1". The reload itself already goes through `call_with_retry`, but the verification did not. Seen on unrelated PRs ClickHouse#110970 and ClickHouse#114029 on 2026-08-09 (`Stress test (arm_debug)`): a debug server under ThreadFuzzer can be slow enough right after a config reload. Give the verify query the same retry treatment (5 attempts, backoff), and keep the fail-close behavior if it persistently fails or the setting is inactive. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110970&sha=2ece842784cf0369655d3a55a7b4363eb3977f50&name_0=PR&name_1=Stress%20test%20(arm_debug) ClickHouse#110970
| # Same capture wrapper as in stress_runner.sh: redirect, not a pipe, because the script leaves | ||
| # clients holding its stdout and a pipe reader waits for those too. | ||
| : > /tmp/stress_script.log | ||
| set +e |
There was a problem hiding this comment.
@groeneai I think a lot of this code can be deduplicated
There was a problem hiding this comment.
Done in da3a17e: the block is now run_capturing_output in stress_tests.lib, so this runner is 4 lines where it was 36. Details in the thread on stress_runner.sh.
| # The mirror ends with the script, but descendants inherit its stdout and can still | ||
| # append. Only a failure row embeds those bytes, so only it pays the settle wait; the | ||
| # flush is what puts them on the console either way. | ||
| if [ "$stress_script_exit_code" -ne 0 ] |
There was a problem hiding this comment.
@groeneai the branches here look identical, you can simplify this
There was a problem hiding this comment.
Gone with the dedup in da3a17e: the status branch is a single append_script_result_row call in stress_tests.lib now, in both runners.
| # past those bytes and never print them. Only `tail` writes to this pipe, so unlike a | ||
| # pipe around the script itself it cannot be held open by an inherited descriptor. | ||
| exec 3>&1 | ||
| mirrored_bytes=$(tail -n +1 -f --pid="$stress_script_pid" /tmp/stress_script.log \ |
There was a problem hiding this comment.
🕵️
@groeneai Reviewed a00d437 and ran the wrapper block from both runners against a stub. One reproducible defect, one structural ask, then I'm happy to merge this.
1. The console mirror is lost when the job's stdout is a regular file
exec 3>&1
mirrored_bytes=$(tail -n +1 -f --pid="$stress_script_pid" /tmp/stress_script.log \
| tee /dev/fd/3 | wc -c)tee /dev/fd/3 does not dup fd 3 — it open()s the path, which resolves through /proc/self/fd to the underlying file and yields a new file description with its own offset. The parent's fd 1 offset stays where it was, so the parent's later writes overwrite the mirrored bytes.
| mirror form | stdout = pipe | stdout = regular file |
|---|---|---|
tee /dev/fd/3 (this branch) |
both lines | mirror lost — only the parent's bytes survive |
tee -a /dev/fd/3 |
both lines | mirror lost — append does not help, the parent still writes from its own offset |
tee >(cat >&3) |
both lines | both lines, in order |
Full wrapper run, failure path, stub with a grandchild that prints at 8 s: piped stdout gives 84 bytes and all four lines; > console.log gives 46 bytes beginning at the flush, with line one and traceback: RuntimeError boom gone — while mirrored_bytes=52 still reports them as shown, so the offset bookkeeping then skips them in the flush too.
Minimal probe:
#!/bin/bash
printf 'AAA-from-tee\n' > /tmp/src.log
exec 3>&1
x=$(cat /tmp/src.log | tee /dev/fd/3 | wc -c) # vs. tee >(cat >&3)
exec 3>&-
printf 'BBB-from-parent\n'bash probe.sh | cat keeps both lines; bash probe.sh > o.log keeps only BBB-from-parent.
In CI the container's stdout is a pipe, so the CI path is unaffected — which is why every validation arm passed. It bites ./stress_runner.sh > log 2>&1, i.e. the local-reproduction workflow this PR exists to serve. One line in each runner: | tee >(cat >&3) | wc -c. Residual nit worth a comment: cat in the process substitution may not have flushed before the parent's next write, so a small interleaving race remains at the boundary — far better than total loss.
2. Please deduplicate the block into stress_tests.lib
stress_runner.sh:305-349 and upgrade_runner.sh:131-174 are byte-identical apart from the wrapped command: 35 lines of fd juggling, an errexit window, an EXIT trap and offset arithmetic, in two copies. The earlier pipe form of this same block cost a 2h09m Stress test (amd_tsan) timeout, so drift here is expensive — and the fix above has to be applied twice precisely because the block was not factored out.
The lib is sourced rather than executed, so set +e/set -e inside a function affects the caller's shell and trap is global. Something like run_capturing_output <capture-path> <cmd...>, returning the command's status, should carry the whole block.
I'd like this in before merge rather than as a follow-up.
3. Coverage
My objection was to a harness that sources the runner and drives it with a stub, and that still stands. But three of the five new lib functions — script_failure_info, flush_capture, drain_capture — are pure: file in, string out, no server, no docker, no runner-sourcing. Covering just those pins the encode/offset/truncation logic, which is the part most likely to break silently, without reintroducing what I asked you to drop. Your own note that inverting the exit-code comparison and pointing tee at /dev/null now both leave the suite green is the argument for it.
4. Smaller items, none blocking
set -exis active in both runners, sodrain_capture's poll emits roughly 10 trace lines/sec for up to 30 s into the job console, interleaved with the mirrored capture.set +xaround the loop would keep it readable.mirrored_bytes=${mirrored_bytes//[^0-9]/}yields""whenwc -cproduced nothing, andfinalize_capture's${mirrored_bytes:-0}then re-prints the entire capture to the console. Fold the default into the sanitizer line instead of relying on each call site.- The truncation marker counts lines (
awk END{print NR}/tail -n), butright(s, $FAILURE_TAIL_MAX_BYTES)then cuts bytes, so a row can say "last 30 of 200 lines" while showing 12. Also, theEscapedrule expands as it encodes, so the cell can reach roughly 6 KB against a constant named..._MAX_BYTES=3000. /test_output/stress_script.logis the whole capture, unbounded, and on a failing run those bytes are already in the job console log — a tail-capped artifact would be cheaper.exec 3>&1clobbers fd 3 without saving it. Nothing in the three files uses fd 3 today, so it is fine; a comment would keep it that way.
Checked and sound
set -e restoration is correct — both runners are set -ex at the top, so errexit really was on. Neither file has a pre-existing EXIT trap, so the new one clobbers nothing, and it does cover start_server 10 || { …; exit 1; } at stress_runner.sh:326. wait after the command substitution returns the script's status, and exit-code propagation held for 0 and 1. escaped_tail's Escaped rule escapes tabs — unlike the pre-existing escaped() — so the row stays four cells and read_test_results' len(line) == 4 check is satisfied; its csv.reader quotechar cannot trigger because the cell always starts with " script exit code: ". drain_capture honours its 15 s grace and 30 s ceiling (measured 15 s on the failure path, with the late 8 s child recovered into both console and artifact). Trap-body failures cannot replace the job status.
Happy to re-review as soon as 1 and 2 are in.
There was a problem hiding this comment.
Sorry for the delay. Both are in, at da3a17e.
1. The mirror. Fixed as you suggested, | tee >(cat >&"$mirror_fd") | wc -c. Your probe is now a test parametrized on what stdout is: mutating it back to tee /dev/fd/N reddens the regular_file arm and leaves pipe green, which is your table exactly. I used a named fd rather than 3 so nothing here can clobber a caller's descriptor, which also covers your last item under 4.
2. Deduplicated. The block moved into stress_tests.lib as run_capturing_output <capture-path> <cmd...>, returning the wrapped command's status with errexit still off, plus append_script_result_row for the row. Each runner is now 4 lines where it was 36 lines. Fixing the mirror once rather than twice is the immediate proof of your point.
3. Coverage. ci/tests/test_stress_capture_lib.py, 40 tests: the three pure helpers, and the wrapper driven by a stub, no server, no docker, no runner sourced. Two properties are load-bearing and every test I had would have stayed green without them, so both now have a test confirmed to redden under the mutation it describes:
- a descendant that outlives the drain and is reaped only after the wrapper returns, bounded by
timeout. Restoring the direct-pipe form exits 124 there. That is the regression that cost the 2h09mamd_tsantimeout. - the wrapped command's status is not the runner's:
upgrade_runner.sh's allow-list exits 0 after a failing script, so reading the trap's own$?drops the artifact on the run that most needs it. That mutation now fails too.
Also || true on the wrapped-command line made $? read zero and emitted an OK row for a failed stress script, with every runner guard green, because that is the one line they skip by design. Guarded now, in both runners.
4. set +x around the poll via local -; the ${...:-0} default folded into the sanitizer; the truncation marker reports whichever limit bit, in its own unit (last 3000 of 15090 bytes vs last 30 of 200 lines), which was also wrong about the count. Not done: the tail-capped artifact. It is a size question independent of this change and you marked it non-blocking, so say the word if you want it here rather than separately.
Residual, unchanged: a writer slower than the settle wait reaches the console but not the row's info cell. No worse than master on any channel master had.
…e mirror Review feedback on the capture wrapper this PR adds to the two stress runners. The mirror used `tee /dev/fd/3`, which does not duplicate fd 3: tee `open()`s the path, and for a regular-file stdout that resolves to a second file description with its own offset, so the shell's later writes overwrite the mirrored bytes. CI redirects the container's stdout to a pipe, where the two forms behave the same, which is why every arm passed; a local `./stress_runner.sh > log 2>&1`, the reproduction workflow this reporting exists to serve, lost the mirror entirely. Mirroring through a process substitution writing to a duplicated descriptor keeps it in both shapes. Measured with the shipped block driven against a stub whose grandchild prints late: with stdout a regular file the old form kept 153 bytes and dropped the first two lines from the console, the new form keeps all 191 in both shapes. The block was byte-identical in `stress_runner.sh` and `upgrade_runner.sh` apart from the command it wrapped, so the mirror fix would have had to be applied twice. It now lives in `stress_tests.lib` as `run_capturing_output`, which returns the wrapped command's status with errexit still off, exactly as the inline window did. Each runner keeps three lines instead of thirty-four. The truncation marker counted lines while `escaped_tail` cuts bytes, so a row could read "last 30 of 200 lines" and show eleven, and a capture cut from 15030 bytes to 3000 was reported as untruncated. It now names whichever limit bit, in that limit's unit. `drain_capture`'s poll runs with xtrace off, scoped by `local -`, instead of tracing about ten lines a second over the mirrored output. The `wc -c` sanitizer folds in its own default rather than leaving each reader to guard an unset offset. `ci/tests/test_stress_capture_lib.py` covers the three pure helpers -- file in, string out, no server, no docker, no sourcing of a runner. Every assertion was checked against a mutant: reporting lines where bytes were cut, `wc -l` for the line count, an off-by-one flush offset, a flush that does not advance, an ignored grace floor, an unbounded wait, a leaked xtrace, a dropped `Escaped` rule and a head-instead-of-tail cut each turn it red. Exit codes 0, 1, 42 and 143 still propagate, a passing run still leaves no artifact, and the EXIT trap still recovers post-settle bytes on the early exits after the wrapper without replacing the status the job reports.
Review of the previous commit found three things.
The wrapper itself had no coverage: breaking the mirror, the exit-code polarity,
the artifact gate or the `EXIT` trap left every test green. Now that the block is
a library function rather than a copy inside each runner, covering it needs only a
stub command, not a harness that sources a runner. Six cases were added, over both
stdout shapes.
`test_drain_capture_waits_for_a_late_writer` asserted nothing. With a 2 s grace
the drain returned at 3 s, before the writer's 6 s sleep, and the late byte was
only on disk by the time Python read the file because `subprocess.run` collects
output and so waits for the writer's inherited pipes to close. A no-op drain
passed it. The write is now scheduled inside the grace window and the capture is
snapshotted in the shell the instant the drain returns.
The `EXIT` trap comment claimed a caller exiting with a different status would be
reported with that status. It would not: `captured_exit_code` is assigned once
from `wait` and no caller reassigns it, so the trap always sees the wrapped
command's status. That is the behaviour the artifact gate wants -- a later failure
of the runner's own does not make the capture worth uploading -- so the comment
was wrong, not the code.
Each of the fifteen assertions was then checked against a mutant of the code it
covers: the mirror opened as a path, the mirror pointed at `/dev/null`, an
inverted exit-code comparison, a swallowed status, errexit restored too early, a
dropped artifact copy, a dropped final flush, a line-unit truncation marker,
`wc -l` for the line count, an off-by-one flush offset, a flush that does not
advance, an ignored grace floor, an unbounded wait, a leaked xtrace, a dropped
`Escaped` rule and a head-instead-of-tail cut. All fifteen turn the suite red.
Two of those mutants survived the first attempt and the tests were fixed rather
than the finding argued: the late-output delay now sits between the two graces, so
it pins which grace a failing run gets, and the early-exit case writes past the
drain ceiling, so the trap is provably what recovers it. That case also needed
`exec >` instead of a `{ ... } > file` group -- a group's redirection is undone
before the shell's EXIT trap runs, which made the trap's flush look lost when it
was the harness at fault. The runners are redirected by the job the same way.
…dget Second review round on the same change. The result-row branch was still duplicated: it was byte-identical in both runners, and nothing covered it, so inverting either runner's success predicate would have reported a failing stress job as a pass with every test green. It moves to `append_script_result_row`, alongside the wrapper. Each runner's whole capture and reporting sequence is now six lines, down from forty-one, and both branches of the row are covered -- status column, the reason in the info cell, four fields on one line, and appending rather than truncating a results file earlier stages wrote to. The tests spent 217 seconds in real sleeps, against a 600-second timeout that covers all forty-six files in `ci/tests`. They now rewrite the drain constants in their own copy of the library rather than waiting the production 5/15/30 seconds, and only the one case that has to tell the two graces apart uses a wide gap; the rest use a narrow set. 78 seconds, and `test_the_production_timing_constants` reads the shipped file directly, so relaxing a real constant still fails -- verified by raising the production timeout to 300 and the grace to 60, each of which turns it red. The full matrix is now twenty-three mutants, none surviving: the mirror opened as a path or pointed at /dev/null, an inverted exit-code comparison, a swallowed status, errexit restored too early, a dropped EXIT trap, a dropped artifact copy, a dropped final flush, an ignored grace floor, an unbounded wait, a leaked xtrace, a line-unit truncation marker, `wc -l` for the line count, an off-by-one flush offset, a flush that does not advance, a dropped `Escaped` rule, a head-instead-of-tail cut, an inverted row predicate, a row without its reason, a truncating row on either branch, and two relaxed production constants. shellcheck is unchanged on both runners and one finding better on the library.
Third review round, both gaps in the tests rather than the code. The encoder-failure guard had no coverage: ignoring `escaped_tail`'s status and accepting its partial output would have stayed green, and partial output carries raw newlines, which splits the row so `read_test_results` drops both halves. Two cases now drive it with a broken encoder -- output then a nonzero status, and a clean status with no output -- and assert the explicit diagnostic, that the row is still one line of four fields, and that none of the partial output leaked in. Ignoring the status, dropping the empty-output check and removing the diagnostic each turn them red. The runners' call sites were also uncovered. They are checked statically rather than by sourcing a runner and driving it with a stub: that harness shape was rejected in review, and the runners reach these lines only after installing packages and starting a server. What is left in each is two library calls, a `$?` read and a `set -e`, so the failure modes are drift between the two copies and a path mismatch, both visible in the text. Seven cases assert that each runner wraps and reports only through the library, that no copy of the replaced block remains, that the status is read from `$?` with errexit restored on the next line, that both helpers get the same capture path, that the capture stays out of the wholesale-uploaded directory, and that the two runners' sequences are identical apart from the command being wrapped. Mutating the runners confirms they discriminate: deleting the caller's `set -e`, reading a constant instead of `$?`, pointing the row at a different capture, removing the wrapper, and moving the capture into `/test_output` each turn them red. 35 tests, 80 seconds.
The wrapper tests could not detect reintroducing either defect they exist to guard. Every stub closed its output within seconds, so a direct pipe -- the form that cost a 2h09m Stress test (amd_tsan) timeout -- would still have finished inside the harness timeout and stayed green. And the only early-exit case paired a failing script with a failing job, while upgrade_runner.sh's allow-list exits 0 after a failing script, so reading the trap's own $? instead of the wrapped status would have dropped the artifact on the run that most needs it. Add a descendant that outlives the drain and is reaped only after the wrapper returns, bounded by timeout so a waiting reader fails by name; the real 1/0 status pair; and a passing script whose late output must still reach the console. Each was confirmed to redden under the mutation it describes.
…holder The wrapped command is excluded from every runner guard, because it is what legitimately differs between the two runners. That left the line where a status suffix does the damage uncovered: `|| true` there makes the following `$?` read zero and emits an OK row for a failed stress script, with all seven runner guards still green. Reject status-transforming suffixes on that line, in both runners. The descriptor-holder test also leaked its `sleep 600`. It is reparented to init when the timed shell exits, so parent-based cleanup could not find it; record the PID and kill it from a trap that also covers the timeout path.
…re-reason The only conflict was in the module-level constant block at the top of stress_tests.lib, where both sides appended: master added START_SERVER_READY_TIMEOUT and this branch added the seven FAILURE_TAIL_* and FAILURE_DRAIN_* tunables. Both are kept; neither side's constant is referenced by the other, and START_SERVER_READY_TIMEOUT remains live at its only consumer, start_server's ready_timeout default. The remaining master hunks in stress_tests.lib, stress_runner.sh and upgrade_runner.sh auto-merged (the analyzer/window-view config drop-ins, report_start_failure, and the "kill -s 0 || return 0" fix).
ClickHouse#115650 removed ci/tests/ and the "CI Tests" job from master. Nothing on master executes that directory any more: outside ci/tests/ itself the only remaining references are the doc examples in ci/praktika/cache.py, and ci/defs/ has no ci_tests job config at all. A file added there merges without a conflict because this branch forked before the removal, so the suite would have shipped as 783 lines that no job can run. The reviewer's only request about this directory on this PR was to remove a test file from it, which is the same disposition. The helpers keep their coverage as the local validation arms recorded in the PR description: each arm extracts the real wrapper block from the runner by content anchor and drives it through the real read_test_results, and the suite is retained out of tree as evidence rather than as coverage this branch ships.
The library runs under `set -ex`, and script_failure_info composes the row in four traced steps (the encoded assignment, the emptiness test, the inner printf and the info assignment). Each one expands the payload, so a failure reason up to FAILURE_TAIL_MAX_BYTES was echoed to stderr four extra times on top of the row and the console mirror, which is the opposite of what a capped, single-copy failure cell is for. Measured with a marker payload and a stub caller: five occurrences on stderr before, one after, and re-removing these two lines restores four, so the suppression is what carries it. The remaining occurrence is the printf in append_script_result_row, which traces the row it is appending. Same `local -` idiom already used by drain_capture, so the caller's own xtrace setting is restored on return.
|
Merged master ( I also dropped One behaviour change while I was in the file: The diff against master is now the three |
`script_failure_info` runs after the wrapped script has already failed, and it encodes the captured tail with `clickhouse local` from the installed package, which is the binary the job is stressing. The call was unbounded, so a wedged encoder blocked both runners at the point that is meant to explain the failure, and the job reported a timeout with no `Test script failed` row at all. Measured against the shipped library with a stub `clickhouse` on PATH: before, `append_script_result_row` never created the results file; after, the row is written with four tab-separated fields and the reason cell degrades to `script exit code: 7 (could not encode the captured output)`, the branch that already existed for a nonzero encoder status. `--kill-after` is load bearing rather than decoration: against a stub that ignores TERM, a bare `timeout 3` waited the child's full 120 seconds, and `various_checks.sh` already refuses `timeout --signal` without it for that reason. The form mirrors `stress_runner.sh:221`. The 60 second bound is about 300x the measured cost of the encode (0.19s over five runs of a debug build), so a slow encoder still yields the reason instead of losing it to a tight bound.
CI finish ledger - 27c390eEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only
170 check-runs completed, 1 red. Session id: cron:our-pr-ci-monitor:20260905-200140 |
Related: #113857
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Stress test (*)andUpgrade check (*)wrap the stress script like this:The script's output is never redirected, so it reaches only the job console; the only thing
stress_job.py::read_test_resultsgets fromtest_results.tsvis the exit status. In the 30 days to2026-08-09, all 152
Test script failedrows (133 pull requests, 6 on master, 11 flavours) had abyte-identical
infocell ofscript exit code: 1, and three of those job logs gave two unrelatedcauses, so the family cannot be triaged from the CI database.
This captures the output and puts its tail into the
infocell of the row the wrapper already emits,outside
/test_output(uploaded wholesale) so a passing run gains no artifact. The script isredirected there and mirrored to the console with
tail --pid, not piped:prepare_for_hung_checkdrops databases with a fire-and-forget
Popen(..., shell=True)inheriting the wrapper's stdout, so apipe reader waits for those clients long after the script exits.
Those clients can also append after the script exits, so the wrapper waits for the capture to stop
growing, then prints the bytes the mirror missed. The wait is a bounded size poll, never a wait on the
descriptor, which is what deadlocked the pipe form. An
EXITtrap looks once more at job end, andthe advancing offset keeps anything from printing twice. A failing
run keeps the capture as
stress_script.log.escaped_tailencodes at one level for theEscapedrule, bounded so a wedged encoder costs thecell rather than the row;
escapedis untouched. The reader decodes\t,\rand\nonly, so anescape it does not decode keeps a visible backslash, and #113857 makes the codec reversible. This
fixes visibility, not the trigger: verify with
length(test_context_raw) > 20, not by the rowsdisappearing.
Validation (click to expand)
Every arm extracted the real wrapper block from each runner by content anchor and drove it with a
stub, asserting through the real
read_test_results. None of it is in the tree:ci/tests/has norunner on master since #115650 removed it with the
CI Testsjob, so the 40 arms below are evidencefor this description rather than coverage this branch ships.
Row content: master gave a 20-byte
info, this gives 517 bytes with the exception line, one parsedrow either way, and the same for a tab, CR, NUL, quote, backslash, embedded
\n, a cut mid-UTF-8,708 KB / 40001 lines, an empty capture and three replayed job logs.
Late writers, with a console pipe that ends with the container and survivors killed, as the job log
behaves: the piped form times out with an empty
test_results.tsv; a child printing 2 s or laterlost the line from row and console before the drain and keeps it after; at 20 s and 30 s the console
and the artifact keep it where the previous head lost both, on both runners and when the epilogue
aborts early, matching master's console at every delay. A descriptor never closed bounds the wait at
16 s instead of hanging. Each line appears once, exit codes 0/1/42/143 are unchanged with an empty
capture, a non-empty capture and an unwritable artifact directory, where preservation warns, and a
passing run adds about 6 s and no artifact.
Mutations each reddened the relevant arm: inverting the exit-code comparison, deleting
set +eorthe restoring
set -e, capturing to/dev/null,echo -eforprintf, the counted offset for thefile size (console 20/20 to 0/20 at a 1.0 s child), and removing the trap.
A passing run leaves the
/test_outputfile set unchanged, and theshellcheck -xfinding setmatches master on all three files.