Repository navigation
CI: do not report "Server died" when a run stops on --max-failures - #107602
Merged
Algunenano merged 2 commits intoJun 16, 2026
Merged
Conversation
…ix UNKNOWN ordering The flaky check runs with `--max-failures 5`. When a test legitimately failed five times, `clickhouse-test` raised `StopTesting` with the default `STOP_TESTING_EXIT_CODE` (2) - the same code used when the server actually dies. The job side (`functional_tests_results.py`) then reported a generic "Server died" leaf and demoted every real failure to `UNKNOWN`, hiding which test actually failed even though the server was perfectly alive. Give the `--max-failures` / `--max-failures-chain` stop its own exit code (`MAX_FAILURES_EXIT_CODE = 4`), distinct from server death and the global time limit. The parent detects the max-failures stop (shared failure counter) and re-raises with the new code; the worker-side raises carry it for sequential runs. The job side reports it as "Too many test failures" and keeps the failing tests as FAIL (real, already-attributed failures) instead of demoting them. Also fix the HTML report ordering: `getStatusPriority` in `json.html` had no branch for UNKNOWN, so it fell through to the lowest priority and sorted below all the OK rows (fail > ok > unknown). Rank UNKNOWN right under the errors and failures so the rows whose real result was lost are visible at the top. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Contributor
|
Workflow [PR], commit [52096ed] Summary: ✅ AI ReviewSummaryThis PR separates Final VerdictStatus: ✅ Approve |
In a parallel run the worker that reaches `--max-failures` or `--max-failures-chain` raises `StopTesting` with `MAX_FAILURES_EXIT_CODE` inside its own process, so that exception never reaches the parent. The parent reconstructed the code only from the shared total-failure counter, so the `--max-failures-chain` path (and `--max-failures 0`) fell through. Worse, reproducing it shows both parallel paths exited 143, not the default 2: the worker's `stop_tests()` does `killpg(SIGTERM)` over the whole process group, killing the parent before it can re-raise with the right code. 143 (`128 + SIGTERM`) is an aborted-run code, so the job side still reported "Server died" and demoted the real failures to `UNKNOWN`. The global time limit path avoids this because the parent initiates it and masks SIGTERM first. Fix: - Carry the worker's intended exit code to the parent through a shared `stop_exit_code` value (set before `stop_testing`); the parent re-raises with it. This covers both `--max-failures` and `--max-failures-chain`. - The max-failures / chain raises no longer call `stop_tests()`, so they do not SIGTERM the parent. The parent masks SIGTERM and terminates the workers in an orderly way, exactly like the time limit path. Server death keeps `stop_tests()` (still reported as "Server died"). - A sibling worker that only observes `stop_testing` now breaks quietly when concurrent instead of calling `stop_tests()`, mirroring the time limit handling. Add focused coverage in `ci/tests`: a unit test that `MAX_FAILURES_EXIT_CODE` maps to a "Too many test failures" leaf and keeps the failures as `FAIL` (contrasted with the aborted-run code that demotes to `UNKNOWN`), and an end-to-end test that a parallel run exits with `MAX_FAILURES_EXIT_CODE` for both the chain-limit and total-limit paths. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
leshikus
self-requested a review
June 16, 2026 12:37
Algunenano
enabled auto-merge
June 16, 2026 12:45
Algunenano
disabled auto-merge
June 16, 2026 13:26
Algunenano
enabled auto-merge
June 16, 2026 13:35
1 task done
This was referenced Aug 5, 2026
pull Bot
pushed a commit
to Spencerx/ClickHouse
that referenced
this pull request
Aug 5, 2026
This parametrization is being killed at the shared 9000s functional-test timeout with tests still unrun, so the job reports error with no failing test and the author sees an unattributable red. Over the 7 days to 2026-08-04 there were 16 such kills, all in a 25s band at 9016-9041s, hitting master twice and 14 PRs by 10 authors, 12 of them from other contributors. The prior 7 days had 5, so the rate is rising. The cause is per-shard volume, not a hang and not one slow test. Successful-run p50 wall time on the slower of the two shards grew from about 5300s (2026-07-04) to about 6800s (2026-08-04). A least-squares fit over those 32 daily p50 values gives about +51s/day, leaving roughly six weeks of headroom on p50 and two on p99 against the cap. Wall time responds to sharding. Fitting wall time against summed per-test time over 1671 successful runs gives wall_s = 255 + 0.08979 * sum_test_s with r = 0.9722, so effective concurrency is about 11x and only about 255s is unshardable setup and teardown. Back-substituting the measured per-shard test-seconds reproduces the measured wall times to within 0.8%. Projected at 3 batches, using the measured crc32 bucket shares, the worst shard lands at a p50 of about 4671s (52% of the cap) and its growth slope falls to about 35s/day. I raised the batch count rather than the timeout: a larger budget lets a genuine hang burn hours, against the fail-fast intent of ClickHouse#106183 and ClickHouse#107602, and it treats the cap instead of the volume. No new mechanism is introduced. Job.ParamSet already emits {batch}/{total_batches} into the job name and ci/jobs/functional_tests.py already forwards --run-by-hash-total and --run-by-hash-num to clickhouse-test. Precedent: ClickHouse#108970 split amd_llvm_coverage the same way, and amd_tsan, s3 storage, parallel already uses 3. The sequential sibling is deliberately left alone: it had 0 runs above 8000s in the same window (p50 5555/6201), so splitting it would spend runners on a problem that does not exist. Partition integrity was verified over all 13230 selectable files in tests/queries/0_stateless using the same crc32(filename) % total predicate as tests/clickhouse-test: 6596 + 6634 at 2 batches, 4461 + 4417 + 4352 at 3. Both sum to 13230 with the union equal to the full set, so no test is lost or duplicated. The no-batch tag is used by 0 test files. The workflow YAML is generated, not hand-edited. Note that praktika yaml runs git add on its output, so a bare git diff reads clean while the generated files have changed; scope must be checked with git diff HEAD. Closes: ClickHouse#113164
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The "Stateless tests (flaky check)" job reports "Server died" and demotes every failing test to UNKNOWN whenever a run stops on
--max-failures, even though the server is perfectly alive.clickhouse-testraisedStopTestingwith the defaultSTOP_TESTING_EXIT_CODE(2) — the same code used for a real server death — so the job side could not tell the two apart and hid which test actually failed.This gives the
--max-failures/--max-failures-chainstop its own exit code (MAX_FAILURES_EXIT_CODE = 4), distinct from server death and the global time limit. The job now reports it as "Too many test failures" and keeps the failing tests asFAIL(real, already-attributed failures) instead of demoting them toUNKNOWNand synthesizing a "Server died" leaf.It also fixes the HTML report ordering:
getStatusPriorityinci/praktika/json.htmlhad no branch forUNKNOWN, soUNKNOWNrows sorted below all theOKrows (fail > ok > unknown).UNKNOWNnow ranks right under the errors and failures, so rows whose real result was lost are visible at the top.Example report where the mislabel is visible — a single failing test (
deltaLakeLocalis not built with MSan) shown as a generic "Server died" plus fiveUNKNOWNreruns: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=107341&sha=49c86b80ca9c46024be1ec61a1c3ba97a45544b8&name_0=PR&name_1=Stateless+tests+%28amd_msan%2C+flaky+check%29&name_2=TestsRelated: #107341
cc @leshikus
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not for changelog (CI only).
Version info
26.6.1.882