Repository navigation
Stress test: report a server abort collected into fatal.log - #113608
Conversation
`Stress test (*)` and `Upgrade check (*)` could exit 1 while every named durability gate on the same job passed, reporting a single content-free row `Test script failed` / ` script exit code: 1` and nothing else: no assertion text, no stack trace, no stack-trace id. The abort was not lost by the harness - it was collected and then discarded. `run_stress_test` greps the server logs for `<Fatal>` into `fatal.log` on every run and uploads it, but nothing read it. The only trigger for crash attribution was a test result literally named `Server died`, written in one place: the `except ServerDied` handler in `stress.py`, whose sole raise site is a single early `kill -0` liveness probe. That probe cannot observe a *dying* server - `BaseDaemon` writes the symbolized stack frame by frame and the child stays a live process throughout, measured at 27-34 s - and it is evaluated once, before the death. So an abort it misses never unlocks the parser, and the job reports only its own exit code. The unconditional scan used to be the behaviour: 85deff3 deleted the `<Fatal>` bash scans from `stress_tests.lib` and replaced them with this row-gated Python parser. The sibling job never regressed - `ClickHouseProc.check_fatal_messages_in_logs` greps `<Fatal>`, runs the same `FuzzerLogParser.parse_failure` and reports, with no dependency on any other row; `functional_tests.py` calls it on every run. Keep the result of the grep that already runs and widen the one condition that already gates the parser, so collected fatal evidence triggers it too. `server_died` stays a separate signal: it is the only one for a silent death (SIGKILL/OOM with nothing logged), which fatal evidence cannot see. Because both triggers share that single gate, the parser still runs at most once per job by construction. The predicate is the collected content rather than the grep's exit code: `rg` also exits non-zero when it did match but could not read some file of the glob, which would drop exactly the crash being reported. Measured on the seven observed shas, master included: `fatal.log` was 41-117 KB and named seven distinct real aborts, two of them recurrences of a separately tracked logical error, while CIDB recorded none of them. A green run's `fatal.log` is 0 bytes. Driven end-to-end against the real uploaded log of one carrier, the job now reports `Logical error: '... typeid(*this) == typeid(rhs)' (STID: 2508-2e0c)` with the symbolized stack instead of `Test script failed`. `upgrade_job.py` calls `run_stress_test`, so the Upgrade check inherits this.
The witness arm asserted the parsed row's name and info but nothing about the stack-trace id, while FuzzerLogParser appends it by interpolation and get_stack_trace_id has two reachable None paths (an empty stack trace, and no DB:: frame surviving the DB::Exception strip). A None therefore becomes the literal text "STID: None" in the row name with the arm still green, even though the changelog entry promises the id. Assert the shape rather than the value: a literal would couple the test to the id's hash function and to ST_MAX_DEPTH, so an unrelated refactor of the id scheme would redden the arm for the wrong reason. The id is satisfiable on this fixture (2508-1573, from its two surviving frames), so this tightens a live assertion rather than adding a new expectation. Verified by patching get_stack_trace_id to return None: the arm fails on this line alone and the other five arms stay green, and with the line removed that same mutation passes, so nothing else in the suite was covering it. The four pre-existing mutants keep their recorded reddening pattern. Not added to the benign-fatal arm, which ends in the parser's Unknown error path and carries no id by design. Co-Authored-By: Claude Fable 5 <[email protected]>
Internal second-model review: 1 major agreed and fixed, 3 nits noted, final gate cleanAn independent cold review plus a second model reviewed this change against the ClickHouse review ❌ Agreed and fixedThe witness test did not pin the stack-trace id that the changelog entry promises. Verified against the generator rather than assumed:
|
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-44:20260806-000900 |
|
cc @maxknv, could you review this? The stress job already greps the server logs for into fatal.log but nothing read it: the abort parser was gated on a test row named |
|
Workflow [PR], commit [d5c842e] Summary: ❌
AI ReviewSummaryThis PR widens Final Verdict✅ Approve |
| `process_results` must turn that malformed-row metadata into a | ||
| visible `Result` so investigators notice the file is corrupt. | ||
|
|
||
| The `run_stress_test` tests at the bottom cover a third flavour: a |
There was a problem hiding this comment.
@groeneai you can remove this test addition altogether
There was a problem hiding this comment.
Done, removed in cb380a1. ci/tests/test_stress_job.py is now byte-identical to master and its 17 pre-existing arms are untouched; the PR is a single-file +5/-1 change to ci/jobs/stress_job.py. I moved the verification record into the PR description so nothing is lost.
One thing worth flagging so the decision is yours rather than mine: the widened condition now ships unpinned. I checked rather than assumed it, by reverting the gate to if server_died: and running the remaining suite, and all 17 tests stay green, so a later refactor can drop the crash_evidence branch without anything going red.
If you would like that covered, the smallest version I can offer is one arm plus one control, roughly 40 lines: a collected fatal log must be reported as a named failure, and a realistic clean log must stay green. Happy to leave it out entirely if you would rather keep this PR to the one condition.
@PedroTadim asked for this test addition to be removed (ClickHouse#113608 (comment)). Reverts ci/tests/test_stress_job.py to its state on master; the file is now byte-identical to master and its 17 pre-existing arms are untouched. The one-condition widening in ci/jobs/stress_job.py is unchanged.
CI finish ledger — cb380a1Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Merged Session id: cron:our-pr-ci-monitor:20260807-040000 |
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 units11 translation units recompiled, 69 s compile time in total, 11 of them have a recent master baseline. Median compile-time ratio to the baselines is ×1.07 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio. |
CI finish ledger - d5c842eEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The Everything else on this head is green: Session id: cron:our-pr-ci-monitor:20260807-103000 |
3719a7f
On ASan builds the server's forced-shutdown branch calls safeExit(0), which calls __lsan_do_leak_check(). That branch is taken precisely because connection handlers and refresh tasks missed the drain timeout, so LSan stops the world and classifies chunks those threads are still using. The reports are unattributable by construction. Two were reported on 2026-08-08 as a uniqExact hash-table "direct leak" (2 MiB on ClickHouse#112846, 4 MiB on ClickHouse#101264). Both are a single allocation with zero indirect leaks, and the two green asan_ubsan jobs on the same commit of ClickHouse#112846 also force-shutdown with connections live while reporting nothing, so neither is an aggregation bug. Since ClickHouse#113608 made previously unattributed sanitizer reports nameable, these compete with real leaks in every stress report. safeExit gets a defaulted run_leak_check parameter, so every existing caller keeps today's behavior, and the two force-exit branches reached while handler threads are still running pass false. A stderr line records that coverage was skipped rather than passed; its wording avoids "<Name>Sanitizer:" so that CI log parsing does not read it as a failure. Keeper's identical-looking branch is left alone on purpose: it calls server_pool.joinAll() first, so no handler is still running there and this report class cannot arise. The client's SIGINT/SIGQUIT handler keeps the default. Clean shutdowns never reach safeExit, so they keep full leak coverage through the ordinary at-exit check. Two mechanisms that look plausible were measured and rejected. __lsan_disable() does not suppress the check: it is an allocation-time per-thread flag, and a probe still reported the leak. Omitting the call does not re-arm the at-exit check either: that check is installed with Atexit(), which _exit() bypasses, so omission can only remove reports, never add any. Co-Authored-By: Claude Fable 5 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Stress test (*)andUpgrade check (*)now report the assertion, stack trace and stack-trace id of a server abort that is collected intofatal.log, instead of only the job's own exit code.Description
run_stress_testgreps the server logs for<Fatal>intofatal.logon every run and uploads it, but nothing read it. The only trigger for crash attribution was a test result literally namedServer died, written in one place:stress.py'sexcept ServerDiedhandler, whose sole raise site is a single earlykill -0liveness probe. That probe cannot observe a dying server, becauseBaseDaemonwrites the symbolized stack frame by frame and the child stays live throughout (measured at 27-34 s), and it runs once, before the death. An abort it missed therefore never unlocked the parser, and the job reported a 20-byteTest script failed/script exit code: 1while every durability gate passed. This scan was unconditional before85deff3297117e6c;ClickHouseProc.check_fatal_messages_in_logsnever regressed and is the shape followed here.This keeps that grep's result and widens the one condition already gating the parser.
server_diedstays a separate signal: it is the only one for a silent death, which fatal evidence cannot see. Both triggers share that single gate, so the parser still runs at most once per job by construction. The predicate is the collected content, not the grep's exit code, becausergalso exits non-zero when it did match but could not read some file of the glob.Across seven observed shas, master included,
fatal.logwas 41-117 KB and named seven real aborts that never reached the CI database; a green run's is 0 bytes. Driven against one carrier's real uploaded log, the job now reportsLogical error: '… typeid(*this) == typeid(rhs)' (STID: 2508-2e0c)with the stack.upgrade_job.pycallsrun_stress_test, so the Upgrade check inherits this. Deliberately unchanged: the new row is unlabelled, matching the existing parser path; theis_oomoverride still lets an OOM pass; and a sanitizer report only instderr.logstill cannot reach the parser.Verification
ci/tests/test_stress_job.pyis byte-identical to master, at @PedroTadim's request; its 17pre-existing arms are untouched. Nothing in-tree pins the change, so the evidence below is the
record of how it was verified rather than something CI re-checks.
Six arms drove
run_stress_testend to end with the docker run replaced by a real shell commandwriting the artifacts it would have produced, A/B'd against pristine master. Four failed before
and passed after: a collected fatal parsed into a named failure, the OOM override still winning
over one, a fatal only in a replica log, and benign
<Fatal>lines not fabricating a name. Twowere controls that held both sides: a realistic clean log staying green, and
Server diedwithouta fatal behaving exactly as before. The first asserts the parsed name; a bare "some result
failed" would hold before the change too, because
Test script failedis itself a failure.Shell.runwas deliberately not stubbed, sinceShell.checkdelegates to it and faking it wouldhave stopped the
rgfrom running and made every assertion vacuous.Five mutants, each applied once and verified to perturb no other line: reverting the gate to
if server_died:reddened the four witnesses; triggering on the log file existing rather than itscontent, and gating on the fatal evidence alone, each reddened exactly one arm, which is what
showed the predicate is the content and that
server_diedis still load-bearing; inverting thecaptured evidence reddened five; making the stack-trace id unavailable reddened one.
The whole
ci/tests/suite is 4 failed / 619 passed on this head, the same four pre-existingfailures as on master, all needing a live server or process control.
Version info
26.8.1.962(included in26.8and later)