Repository navigation
Conversation
…sive When the test runner (`clickhouse-test`) is killed by the harness wall-clock timeout (signal `SIGTERM` -> `runner_exit_code` of `-15`), `FTResultsProcessor` currently appends a synthetic `Server died` `FAIL` leaf regardless of why the runner timed out. On `PR` and `Stateless tests (arm_asan_ubsan, targeted)` jobs the actual ClickHouse server was healthy in many of these cases - the runner only ran out of wall-clock time because its background `Distributed` system-log sender kept retrying to ship rows to the CIDB staging cluster (`kng4alm55c.us-east-2.aws.clickhouse-staging.com:9440`) and the cluster was overloaded. The result was hundreds of cross-PR false-positive "Server died" failures (77 hits / 57 distinct PRs / 0 master in the trailing 30 days), with PR ClickHouse#106154 being one such victim. Per @alexey-milovidov on PR ClickHouse#106154: > Send another PR that will work around that by not making the CI check > red if that staging cluster is not responding. Add a conservative classifier `is_ci_logs_cluster_overload` that scans `clickhouse-server.err.log` when `runner_exit_code` is in `ABORTED_RUN_EXIT_CODES` and no individual tests failed. The classifier reports an overload iff: * no real-crash markers (`<Fatal>`, `AddressSanitizer:`, `MemorySanitizer:`, `ThreadSanitizer:`, `UndefinedBehaviorSanitizer:`, `LOGICAL_ERROR`) appear in the log; * at least 100 `<Error>` lines are present (chronic-overload signature, not transient blip); * at least 95% of those `<Error>` lines name a `Distributed`-shipping logger (`DistributedAsyncInsertQueue`, `DistributedAsyncInsertBatch`, `DistributedSink`, `BgDistSchPool`, `StorageDistributed`, `system.<table>_sender`). When the classifier fires, the run gets an informational `CIDB log cluster unresponsive` `SKIPPED` leaf instead of a `Server died` `FAIL` leaf, the outer status stays `OK`, and the secondary "clickhouse-test exited with code N" `FAIL` guard is bypassed. Any real crash, sanitizer report, `LOGICAL_ERROR`, or individual test failure keeps the legacy `Server died` `FAIL` path - the heuristic only ever silences a run that would otherwise be a false positive. Unit tests in `ci/tests/test_functional_tests_results.py` cover: * the classifier directly (missing log, empty log, threshold edge, real-crash marker abstention, dominance threshold); * `FTResultsProcessor.run` end-to-end across the four aborted exit codes (-15, -9, 143, 137), with and without staging-overload signals and with and without a real crash mixed in. Original sighting: ClickHouse#106154 CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=106154&sha=cb7df05db57791a4c0a6930f529efba79066e075&name_0=PR&name_1=Stateless%20tests%20%28arm_asan_ubsan%2C%20targeted%29 Co-Authored-By: Claude Opus 4.7 <[email protected]>
Pre-PR validation gatea) Deterministic repro? Yes. The classifier reads a sample b) Root cause explained? The CIDB staging log cluster c) Fix matches root cause? The fix is the explicit @alexey-milovidov workaround — it is not a speculative defensive change. The classifier only fires when the d) Test intent preserved? / New tests added? Preserved. The legacy e) Both directions demonstrated? Yes. f) Fix is general? Yes. session: cron:clickhouse-ci-task-worker:20260531-031500 |
|
cc @maxknv — could you review this? It adds a conservative |
Two blockers identified in the bot review on commit `109d3ed6`: 1. The reclassification branch in `FTResultsProcessor.run` did not check `success_finish`. If the harness wall-clock fired mid-suite, no test may have emitted `FAIL` yet and `err.log` could still be dominated by `Distributed`-shipping retries, so the run was marked OK with only a `SKIPPED` leaf even though not all selected tests ran. Require `s.success_finish` before reclassifying. 2. `is_ci_logs_cluster_overload` read only the first 64 MiB of `clickhouse-server.err.log`, but under chronic overload the file can grow to hundreds of MiB. A `<Fatal>` / sanitizer / `LOGICAL_ERROR` marker appended past 64 MiB was missed, silently suppressing real `Server died` failures. Stream the full file line by line. Three regression tests added in `ci/tests/test_functional_tests_results.py`: * `test_run_keeps_server_died_when_test_run_was_incomplete` — `test_result.txt` lacks `All tests have finished`, `err.log` matches the overload pattern, runner exit `-SIGTERM`. Result must stay FAIL with `Server died`. * `test_overload_classifier_scans_full_file_for_late_fatal_marker` — 65 MiB `err.log` of shipping noise followed by a single `<Fatal>` line on the last line. Classifier must return `False`. * `test_run_keeps_server_died_when_oversized_log_has_late_logical_error` — same shape end-to-end through `FTResultsProcessor.run` with `LOGICAL_ERROR`. Result must stay FAIL with `Server died`. All 18 tests pass locally (`pytest ci/tests/test_functional_tests_results.py`).
|
@groeneai, resolve the conflicts. |
Resolves conflicts in `ci/jobs/scripts/functional_tests_results.py` between
the CIDB staging cluster overload heuristic on this branch and master's
`GLOBAL_TIME_LIMIT_EXIT_CODE` graceful-stop branch (commit `5dc349c6e9a`).
Both behaviors are preserved:
* Aborted run by `STOP_TESTING_EXIT_CODE` / signals -> attempt the
CIDB staging-cluster overload reclassification (gated on
`s.success_finish` and `is_ci_logs_cluster_overload`); else emit
`Server died`.
* Aborted run by `GLOBAL_TIME_LIMIT_EXIT_CODE` -> emit the benign
`Global time limit reached` informational leaf.
* Non-zero exit code guard now excludes BOTH `GLOBAL_TIME_LIMIT_EXIT_CODE`
(graceful) AND `ci_logs_cluster_overload` (infrastructure) so neither
repaints the run red.
Local verification: `pytest ci/tests/test_functional_tests_results.py -v`
-> 18/18 pass.
Resolves merge conflict per `@ alexey-milovidov` directive on
ClickHouse#106176.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
@alexey-milovidov rebased onto current master via merge commit and pushed (
|
Resolves conflicts in ci/jobs/scripts/functional_tests_results.py and the add/add conflict in ci/tests/test_functional_tests_results.py against master's new MAX_FAILURES_EXIT_CODE handling (the --max-failures / --max-failures-chain "Too many test failures" leaf). Production file: the ABORTED_RUN_EXIT_CODES branch keeps this branch's CIDB staging-cluster overload reclassification (gated on s.success_finish and is_ci_logs_cluster_overload), and master's new elif MAX_FAILURES_EXIT_CODE branch is appended after it. The non-zero-exit guard already excludes both GLOBAL_TIME_LIMIT_EXIT_CODE and ci_logs_cluster_overload. Test file: both sides independently created ci/tests/test_functional_tests_results.py. Unioned all 18 CIDB-overload tests with master's 2 max-failures tests; merged the import block (FTResultsProcessor, ABORTED_RUN_EXIT_CODES, MAX_FAILURES_EXIT_CODE, STOP_TESTING_EXIT_CODE, is_ci_logs_cluster_overload, _STAGING_OVERLOAD_MIN_ERRORS) and the helpers (_write_err_log, _process, _named). Local verification: 20/20 pass. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
@alexey-milovidov conflicts resolved. Merged master into the branch (commit 08b8859); no rebase per repo convention. Two conflicts, both in the FT results parser:
Local: |
CI finish ledger - 08b8859CI fully finished on this head (Finish Workflow + Mergeable Check SUCCESS, no checks queued/in_progress). Every failure below has an owner: a fixing PR, or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only
No ClickHouse test FAIL/ERROR on this commit (CIDB): the 23 executed checks passed, the rest skipped. Ready for review. Session id: cron:our-pr-ci-monitor:20260625-040000 |
Address the `clickhouse-gh` / AI review blocker on PR ClickHouse#106176. The CIDB staging-cluster overload classifier counted any `<Error>` line naming a bare `Distributed` logger/engine (`DistributedAsyncInsertQueue`, `BgDistSchPool`, `DistributedSink`, `StorageDistributed`, ...). Those also fire for a test-owned `Distributed` table, and `FTResultsProcessor` is shared with `ci/jobs/fast_test.py`, which never starts log export - so a completed run killed by the wall-clock timeout after a real non-CIDB `Distributed` regression could be reported `OK` with only a `CIDB log cluster unresponsive` leaf. Key the classifier strictly on the CIDB log-export path `system.<table>_sender` instead. `setup_log_cluster.sh` ships system logs through `Distributed` tables named `system.<table>_sender`, and their retries are logged under the directory-queue logger `system.<table>_sender.DistributedInsertQueue.<disk>` (see `DistributedAsyncInsertDirectoryQueue::getLoggerName`), which always contains that substring. Tables cannot be created in the `system` database by tests, so this name space is CI-owned and a run that never started log export has no `_sender` tables - a real non-CIDB `Distributed` failure can no longer be silenced. Fix the sample lines in the test to the real logger-name format and add two regressions (classifier-level and end-to-end through `FTResultsProcessor.run`) covering a non-CIDB `Distributed` error log. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Addressed the What was too broad: the overload classifier counted any Fix: key the classifier strictly on the CIDB log-export path Tests: corrected the sample |
The `Style check` job's `ruff` step failed with `F401` on `ci/tests/test_functional_tests_results.py:26`: `pytest` was imported but never used (the regression tests added in the prior commit use plain `assert` and are discovered by name, so the import is dead). Drop it. Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=106176&sha=ba4adc0b7e770483ec104d7933f3d83551de777a&name_0=PR&name_1=Style%20check Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
clickhouse-gh[bot] correctness follow-up on the system.<table>_sender narrowing: keying on any system.*_sender log line is still forgeable, because a functional test can create tables in the system database (e.g. 02494_query_cache_system_tables.sql creates system.system), so a test could create system.fake_sender and flood the log with matching Distributed shipping errors. FTResultsProcessor is also shared with fast_test.py, which never starts log export, so it can never legitimately ship to the CIDB staging cluster. Two independent layers now guard the reclassification: 1. Un-forgeable gate: thread log_export_started from functional_tests.py into FTResultsProcessor. The overload reclassification is consulted only when the harness actually ran start_log_exports for this run. A test cannot flip the harness process flag, so fast_test.py runs and local runs (which never start log export) can never be greened. 2. Tightened regex: system.\w+_sender -> system.\w+_log_sender. Senders are created only for system.%_log tables by setup_log_cluster.sh, so a bare system.foo_sender no longer matches. Regression tests: a run with 500 forged system.fake_sender lines and no log export stays Server died; the same with log export started also stays Server died (regex layer); the classifier rejects the forged bare _sender name. pytest ci/tests/test_functional_tests_results.py: 25/25 pass. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…uster-overload-server-died Resolves the conflict in ci/jobs/functional_tests.py: master removed the create_minio_log_tables() setup step, this branch had added an else-branch after start_log_exports() that snapshots the concrete system.<table>_sender tables. Kept master's removal and this branch's snapshot.
|
Conflicts resolved in merge commit c2645b1 (fast-forward push, your merge commits untouched). One conflict, in Local: |
…uster-overload-server-died Conflicts in `ci/jobs/scripts/functional_tests_results.py` and `ci/tests/test_functional_tests_results.py`, both in the `ABORTED_RUN_EXIT_CODES` branch that this PR restructured. Master added the bugfix-validation carve-out to the single-culprit demotion (keep `FAIL` instead of `ERROR` when `is_bugfix_validation`, see ClickHouse#105789) inside the same block that this branch moved under the `else` of the CIDB-staging-overload check. Resolution keeps both: the overload reclassification stays the outer condition, and master's bugfix-validation-aware demotion is used verbatim in the `else` arm. Test-file conflicts were purely additive on both sides - kept every test from master and from this branch.
…binaries Address the `clickhouse-gh[bot]` review: the overload heuristic is safe only because it is keyed off the concrete `system.<table>_sender` `Distributed` tables captured before any test ran. The bugfix-validation loop restarts the server for each master-HEAD build type and `CH.start` wipes the server data directory, so after the first swap those CI-owned tables are gone and log export is not set up again. Carrying the pre-swap snapshot into the later runs left the classifier keyed off names that no longer belong to CI, so a test could create `system.query_log_sender` itself and have its shipping errors read as log-export noise. Reset the snapshot on the swap path. With an empty set the classifier abstains and the run stays on the `Server died` path, which is the fail-close behavior already covered by `test_run_keeps_server_died_when_log_export_not_started`. New `ci/tests/test_bugfix_validation_sender_snapshot.py` pins the reset, its position relative to the restart and to the per-build-type `FTResultsProcessor`, and that the only other writer of the snapshot is the pre-suite `CH.get_log_export_senders` capture.
Address the `clickhouse-gh[bot]` blocker: keying the overload heuristic
off captured `system.<table>_sender` NAMES is still forgeable. A test can
create and drop tables in the `system` database (see
`02494_query_cache_system_tables.sql`), so it can drop a CI-created
sender, recreate its own `Distributed` table under the same captured
name, emit `system.query_log_sender.DistributedInsertQueue.*` errors and
have them read as CI log-export noise.
`system` is an `Atomic` database in the server, so a recreated table gets
a fresh `uuid`. `get_log_export_senders` now captures `{name: uuid}`
before any test runs (and skips a zero `uuid`, which carries no identity
to verify), and the new `verify_log_export_senders` re-reads
`system.tables` after the suite and keeps only the names whose `uuid` is
unchanged. Every `FTResultsProcessor` is constructed from that verified
set. It fails closed: a dropped, rebound, or unreadable sender - and a
server that really did die, so the query returns nothing - yields an
empty set, the classifier abstains, and the run keeps `Server died`.
New `ci/tests/test_log_export_sender_identity.py` covers the snapshot and
the verification, including the bot's rebind-under-the-same-name
scenario; `test_bugfix_validation_sender_snapshot.py` additionally pins
that no processor is handed the unverified snapshot.
|
🕵 Rebased onto current Conflicts. Blocker 1 (stale sender snapshot across the bugfix-validation binary swap) — Blocker 2 (a captured name can be rebound by a test) — Locally: |
Address the `clickhouse-gh[bot]` follow-up: `CREATE TABLE ... UUID '<captured uuid>'` IS accepted in an `Atomic` database, so a test can drop a captured `system.<table>_sender` and recreate its own `Distributed` table under both the same name and the same `uuid`. Widen the captured identity to `uuid`, `metadata_modification_time` and a hash of `engine_full`. The metadata timestamp is the component no SQL can choose: it is the mtime of the table's metadata file, so a table recreated while the suite runs is necessarily stamped later than the pre-suite snapshot. `setup_log_cluster.sh` creates the senders once at setup and never alters them afterwards, so the timestamp is stable for a genuine CI-owned sender, and `stop_logs_replication` drops them only after the results are processed. Entries with a zero `uuid` or an unset metadata timestamp are dropped from the snapshot instead of being trusted, and any mismatch at verification time removes the name, so the classifier abstains and the run keeps `Server died`. `ci/tests/test_log_export_sender_identity.py` gains the requested regression - a sender recreated with the captured `uuid`, both at the `verify_log_export_senders` level and end-to-end through `FTResultsProcessor` with a log flooded by that rebound table - plus the differing-engine and missing-timestamp cases.
|
🕵 Addressed the 08:32 AI Review blocker ( You are right: The captured identity is now a fingerprint of Regression tests as requested, in
69/69 local tests pass across the five related |
Address the `clickhouse-gh[bot]` follow-up: `metadata_modification_time` is a `DateTime`, so a test that recreates a captured `system.<table>_sender` with the same explicit `UUID` and engine inside the snapshot second still matched the fingerprint. Capture the sender's `metadata_path` and `stat` it on the host, folding the inode and the NANOSECOND mtime into the fingerprint. That is the one component no query can choose. `metadata_path` is relative to the server's data directory, so it is resolved against the `path` server setting before the `stat` - otherwise every lookup would miss and the heuristic would silently never fire. A metadata file that cannot be stat'ed drops its sender from the snapshot, so the classifier abstains and the run keeps `Server died`. Verified against a running server (26.7): `DROP TABLE ... SYNC` plus `CREATE TABLE system.query_log_sender UUID '<captured uuid>' ENGINE = Distributed(...)` in the same second keeps `uuid`, the `engine_full` hash, `metadata_path` and `metadata_modification_time` identical - and the metadata file's mtime still moves (`09:16:31.351259320` -> `09:16:31.552260858`), so `verify_log_export_senders` returns an empty set. `ci/tests/test_log_export_sender_identity.py` adds the same-second rebind at both the unit and the end-to-end `FTResultsProcessor` level, the unstat'able-metadata-file case, and a guard that the query resolves the relative `metadata_path`.
|
🕵 Addressed the 09:07 AI Review blocker (second-resolution Took the suggested route: the fingerprint now includes the sender's metadata file identity read from the host — I verified the attack and the defence against a real server (26.7.1), not just in unit tests. So the exact scenario you described reproduces (every Regressions added in 71/71 local tests pass across the related |
…uster-overload-server-died
|
🕵 Status update. The previous head was never actually tested. The run for Actions in this pass:
On the outstanding AI Review verdict: it was generated against Now blocked solely on the fresh CI run plus human review and merge. |
CI finish ledger - be3700eEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
This diff is confined to
Session id: cron:our-pr-ci-monitor:20260810-193000 |
…uster-overload-server-died
|
🕵 Closing this PR: the requested non-failing reclassification cannot be made safe while functional tests can write to the genuine CI log-export sender tables. The pushed fail-closed commit removes the unsafe implementation; the branch is source-identical to |
Per @alexey-milovidov on PR #106154 (2026-05-31T02:17:47Z):
Problem
FTResultsProcessorinci/jobs/scripts/functional_tests_results.pyadds a syntheticServer diedFAILleaf wheneverrunner_exit_codeis inABORTED_RUN_EXIT_CODES = {2, 137, 143, -15, -9}. This covers in-band aborts (StopTesting, exit code2) but also any out-of-band kill, including the harness wall-clock timeout.A pathological pattern hits stateless jobs that run with the targeted/test-batch wall-clock budget (e.g.
Stateless tests (arm_asan_ubsan, targeted), 50-minute cap): the ClickHouse server is healthy and every individual test passes, but the backgroundDistributedsystem-log sender keeps retrying to ship rows fromsystem.<table>_sendertables to the CIDB staging log cluster (kng4alm55c.us-east-2.aws.clickhouse-staging.com:9440). When that staging cluster is overloaded, the retries pile up,_flush_system_logsblocks, the runner runs out of wall-clock time, the harness sendsSIGTERM(Pythonsubprocess.returncode == -15), andFTResultsProcessorpaints the check red withServer died.CIDB shows this is a real chronic infra-noise pattern, not a hypothetical: 77 hits across 57 distinct PRs and 0 master in the trailing 30 days, with a single-day burst of 50 hits across 43 unrelated PRs on 2026-05-30. PR #106154 was one such victim - all 1683 tests passed, server exited normally with code 0, and
clickhouse-server.err.logcontained 1902 errors, every one of which was aDistributedAsyncInsertQueue/BgDistSchPoolretry targeting the staging cluster (1533TOO_MANY_PARTS+ 253SOCKET_TIMEOUT+ 246NETWORK_ERROR).Fix
Add a conservative classifier
is_ci_logs_cluster_overloadthat scansclickhouse-server.err.logwhenrunner_exit_codeis inABORTED_RUN_EXIT_CODESand no individual tests failed. The classifier reports an overload iff:<Fatal>,AddressSanitizer:,MemorySanitizer:,ThreadSanitizer:,UndefinedBehaviorSanitizer:,LOGICAL_ERROR) appear;<Error>lines are present (chronic-overload signature, not transient blip);<Error>lines name aDistributed-shipping logger (DistributedAsyncInsertQueue,DistributedAsyncInsertBatch,DistributedSink,BgDistSchPool,StorageDistributed,system.<table>_sender).When it fires, the run gets an informational
CIDB log cluster unresponsiveSKIPPEDleaf instead of aServer diedFAILleaf, the outer status staysOK, and the secondaryclickhouse-test exited with code NFAILguard is bypassed. Any real crash, sanitizer report,LOGICAL_ERROR, or individual test failure keeps the legacyServer diedFAILpath - the heuristic only ever silences a run that would otherwise be a false positive.Tests
New
ci/tests/test_functional_tests_results.pycovers:FTResultsProcessor.runend-to-end across all four aborted exit codes (-15,-9,143,137), with and without staging-overload signals and with and without a real crash mixed in.15 / 15 pass locally. Existing
ci/tests/test_bugfix_validation_inverter.pyandci/tests/test_cidb.pycontinue to pass.References
-15after harnessTimeout exceeded [2806]): https://github.com/ClickHouse/ClickHouse/actions/runs/26683080414/job/78654762190Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes
Workflow [PR]
Sync PR [sync-upstream/pr/106176]