Repository navigation
Do not report "Server died" when a test run hits the global time limit - #106183
Conversation
The flaky and targeted stateless checks deliberately rerun the selected
tests until their time budget is exhausted (`rerun_count = 50`, so the
time limit is the intended stop condition). `clickhouse-test` raised
`StopTesting` for five unrelated reasons - server died, hung check,
`--max-failures`, and the global time limit - all exiting with the same
`STOP_TESTING_EXIT_CODE`, which the job side mapped unconditionally to a
synthetic "Server died" leaf. A clean, expected timeout was therefore
indistinguishable from a real crash.
Give the graceful time-limit stop a distinct `GLOBAL_TIME_LIMIT_EXIT_CODE`
and report it as a benign "Global time limit reached" result rather than
"Server died". Hand the budget to `clickhouse-test` via `--global_time_limit`
so it stops gracefully between tests; keep the external `Shell.run` timeout
only as a larger safety net for a genuinely frozen process.
To keep the graceful exit code from being clobbered into 143 ("Server
died") by the `killpg` feedback loop in `stop_tests`, parallel workers
now stop quietly on the deadline and the parent ignores `SIGTERM` while
terminating them.
Example of a targeted check mislabeled as "Server died" on timeout:
https://s3.amazonaws.com/clickhouse-test-reports/PRs/105943/9a0a506d1908116e6fc0532eff6a1c126b5cbcfb/stateless_tests_arm_asan_ubsan_targeted/job.log
Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Workflow [PR], commit [4d2250a] Summary: ✅ AI ReviewSummaryThis PR separates the expected functional-test global timeout from real runner aborts by passing Findings
Final VerdictStatus: Minimum required action: preserve hung-check/server-not-responding failure precedence when the global deadline and parent liveness probe happen in the same polling iteration. |
The external `Shell.run` safety-net timeout was `global_time_limit + 600`, but a test that starts just before the global deadline can still be inside its own per-test alarm window, which `clickhouse-test` arms as `int(args.timeout * 1.1) + 60` (720s with the default `--timeout 600`). With only a 600s margin the external `SIGTERM` could fire before the graceful per-test stop, returning `143` and reporting `Server died` - exactly the misclassification this PR removes. Widen the margin to 900s so it exceeds the per-test bound plus the worker shutdown wind-down, leaving the external kill for a genuinely frozen process. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
| # distinct from a server death or a hung check below. Only claim the | ||
| # time limit if nothing else has already requested a stop, so a real | ||
| # server death or `--max-failures` abort keeps precedence. | ||
| if ( |
There was a problem hiding this comment.
global_time_limit_reached is set before the parent runs the --hung-check liveness probe below, and the later if global_time_limit_reached branch forces GLOBAL_TIME_LIMIT_EXIT_CODE. If the server becomes unresponsive in the same polling iteration that crosses args.stop_time, this branch claims the benign timeout first; the immediately following hung check can still print Hung check failed and set stop_testing, but the final exit remains 3, so FTResultsProcessor reports an OK Global time limit reached leaf instead of a failed server-not-responding run. The PR says real hung/server failures keep precedence, so please run the liveness check before claiming the global timeout or clear the benign flag when the hung check fires.
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
`ABORTED_RUN_EXIT_CODES` synthesizes a "Server died" FAIL leaf for any death-by-signal of the test command, so a run that was killed externally is reported as a server crash even when nothing observed one. On PR ClickHouse#108676 / Stateless tests (amd_tsan, parallel) the report read "Failed: 0, Passed: 10564, Skipped: 171" with "Server died" as the only failure: three tests completed [ OK ] in the final two seconds before the kill, the server then answered "system flush logs" and stopped cleanly under --do-not-kill, and the job log had zero <Fatal>, zero "Received signal" and a clean dmesg. Measured over 30 days, 53 stateless and fast test jobs across 49 PRs carry that leaf with no other failing row. The exit code establishes only that the run was killed, never by whom, so when the parser observed no failure at all the honest verdict is that the cause could not be attributed. Report ERROR with a leaf naming what was actually observed instead of asserting a cause. The job stays red either way (neither FAIL nor ERROR is in `Result.is_ok`), so for a normal job this only changes the wording. ERROR rather than FAIL because `invert_bugfix_validation_status` flips any FAIL row to OK without inspecting its name, which would turn an exit code into a claimed bug reproduction. ERROR is the existing inconclusive channel, and `reconcile_bugfix_crash_repro` still downgrades ERROR to FAIL when a BLOCKER fatal is present, so a genuine crash keeps validating (ClickHouse#105789). The gate reads the summary counters rather than filtering rows through `is_failure()`: a [ NOT_FAILED ] row increments `failed` but is stored with a status string that `is_failure()` does not match, so filtering rows would reclassify a run whose failure was reported. `STOP_TESTING_EXIT_CODE` is deliberately excluded, since the parent raising `StopTesting` did observe a reason to stop. Related: ClickHouse#106183
The flaky and targeted stateless checks deliberately rerun the selected tests until their time budget is exhausted (
rerun_count = 50, so the global time limit is the intended stop condition, not the repeat count). However,clickhouse-testraisedStopTestingfor five unrelated reasons — server died, hung check,--max-failures, and the global time limit — all exiting with the sameSTOP_TESTING_EXIT_CODE, which the job side mapped unconditionally to a syntheticServer diedleaf. A clean, expected timeout was therefore indistinguishable from a real crash and reported asServer died.This change gives the graceful time-limit stop a distinct
GLOBAL_TIME_LIMIT_EXIT_CODEand reports it as a benignGlobal time limit reachedresult instead ofServer died. The time budget is now handed toclickhouse-testvia--global_time_limitso it stops gracefully between tests; the externalShell.runtimeout is kept only as a larger safety net for a genuinely frozen process.To keep the graceful exit code from being clobbered into
143(which is treated asServer died) by thekillpgfeedback loop instop_tests, parallel workers now stop quietly on the deadline and the parent ignoresSIGTERMwhile terminating them. Genuine server deaths and--max-failuresaborts keep precedence over the time-limit path.Example of a targeted check mislabeled as
Server diedon timeout (and corresponding PR #105943):https://s3.amazonaws.com/clickhouse-test-reports/PRs/105943/9a0a506d1908116e6fc0532eff6a1c126b5cbcfb/stateless_tests_arm_asan_ubsan_targeted/job.log
#105943
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes
🤖 Generated with Claude Code
Version info
26.6.1.310