Repository navigation
CI: wait for a CI database query slot instead of failing the test-selection step - #120928
alexey-milovidov merged 1 commit into
Conversation
…ection step
A `Stateless tests (..., selected tests)` job dies before running a single test
with `Failed to select tests: Failed to get previously failed tests required for
test selection`. Eight such job deaths were measured over six days on six PRs
between 2026-08-20 and 2026-09-18; four of them, including both on 2026-09-18,
are the CI database answering HTTP 500 `Code: 202. DB::Exception: Too many
simultaneous queries. Maximum: 1000`.
`queue_max_wait_ms` defaults to 0, and it is honoured by exactly the 202 branch
these requests hit: `ProcessList.cpp:183-193`, the `max_size`
(`max_concurrent_queries`) branch. At 0 the server throws immediately; at a
positive value it logs "Too many simultaneous queries, will wait N ms." and waits
on `have_space` for an admission slot, throwing only if the wait expires. The
sibling 202 branches carry different messages ("for all users", "for user X",
"insert/select queries", "for table X"), so the attribution is exact. praktika
never sends the setting, so every CI database request asks to be rejected rather
than queued, and `_post_with_retries` then spends its five attempts in 31 s
re-asking a saturated server. Because a `selected tests` run passes
`include_changed_tests=True`, `find_tests.py` has `strict=True` and converts that
into an ERROR result with zero tests run.
Send `queue_max_wait_ms` at half the caller's own timeout (30000 ms for queries,
10000 ms for inserts and the smoke test) from the single shared helper, so the
server waits for a slot instead of rejecting, and without issuing another request
to an already saturated server. This covers `query`, `insert_rows` and `check`.
The fail-closed selection policy itself is deliberate and is left untouched.
Separately, the selected-tests error handler rendered only `str()` of the outer
exception, whose message is a fixed string, so the preserved `__cause__` chain
was never shown. One of the eight occurrences (2026-09-06) therefore carries no
diagnostic at all and cannot be attributed today. Render `traceback.format_exc()`
as well; that handler catches every selection leg, and `Result.info` reaches all
three places a human looks: the job log, the HTML report and the CI database.
Validated on a server with `max_concurrent_queries=1` and the only slot held:
plain `SELECT 1` returns 500 `Code: 202` in 0.06 s; with
`queue_max_wait_ms=30000` it returns 200 after a 4.01 s wait, the holder's
remaining time, and the server logs "will wait 30000 ms."; with
`queue_max_wait_ms=1` it returns 500 again, which isolates the wait duration as
the causal variable. Seam assertions cover both hunks, each with a patch-revert
negative control.
Related: ClickHouse#114417
Co-Authored-By: Claude Opus 5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings;
Severity: ❌ blocker / Checks behind the verdict, for the record: the error string Session id: cron:clickhouse-review-slot-9:20260918-221700 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-41:20260918-214800 |
|
Workflow [PR], commit [2cf44dc] Summary: ✅ AI ReviewSummaryThis PR teaches the shared Final Verdict✅ No actionable findings. LLVM Coverage Report |
12bfa4e
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not required (CI-only change).
Description
Related: #114417 (the request to investigate this if it recurred; it did on 2026-09-18). Job log: https://github.com/ClickHouse/ClickHouse/actions/jobs/105539654847
What breaks. A
Stateless tests (..., selected tests)job dies before running a single test, withFailed to select tests: Failed to get previously failed tests required for test selection. I measured 8 such deaths on 6 days across 6 PRs; 4, including both on 09-18, are the CI database answering HTTP 500Code: 202 ... Too many simultaneous queries. Maximum: 1000.Root cause.
queue_max_wait_msdefaults to 0, and it is honoured by exactly the 202 branch this hits (ProcessList.cpp:183-193, themax_sizebranch): at 0 the server throws at once, at a positive value it waits for an admission slot. praktika never sends it, so every request asks to be rejected rather than queued, and the client spends its 5 retries in 31 s re-asking a saturated server.strict=Trueon aselected testsrun makes that fatal. I am not touching that fail-closed policy; it is deliberate (#114730).Change (2 files, 5 lines).
_post_with_retriessendsqueue_max_wait_msat half the caller's timeout (30000 ms for queries, 10000 for inserts), coveringquery,insert_rowsandcheck. The selected-tests error handler also renderstraceback.format_exc(): today it prints only the outer fixed string, so 1 of the 8 occurrences has no diagnostic.Validation. With
max_concurrent_queries=1and the only slot held,SELECT 1gives 500Code: 202; withqueue_max_wait_ms=30000it gives 200 after a 4.01 s wait, the holder's remaining time; withqueue_max_wait_ms=1, 500 again. Both hunks also have negative-control seam assertions; the end-to-end gate is this PR's own CI, since every job inserts to CIDB through the changed helper.Scope. This is the client-side half only; the server-side lever on that cluster is your call. I can add a unit test if the
CI Testsrunner returns.The 8 measured occurrences (from job logs, not CIDB)
amd_asan_ubsan, distributed plan, parallel, selected testsCode: 202amd_asan_ubsan, db disk, distributed plan, sequential, selected testsCode: 202amd_tsan, s3 storage, parallel, selected testsaws: [ERROR] ... (NoCredentials)amd_asan_ubsan, db disk, distributed plan, sequential, selected testsamd_tsan, sequential, selected testsaws: [ERROR] ... (NoCredentials)amd_tsan, s3 storage, parallel, selected testsamd_asan_ubsan, distributed plan, parallel, selected testsCode: 202amd_asan_ubsan, db disk, distributed plan, sequential, selected testsCode: 202One infra cause produced 3 red checks on 09-18, and two
Bugfix validationjobs were dropped behind them.Only 4 have a row in
default.checks: on 2026-09-18 the jobs' own result insert also hitCode: 202, so they left no row. Breadth for this family has to come from job logs or the check-runs API.Not addressed, deliberately: the secret-fetch variant (2 of the 8) died with the move of
secret.pyto boto3, so I added nothing for a mechanism that no longer exists, and the traceback makes the remaining unattributable occurrence nameable rather than fixed.cidb_cluster.pyis a second HTTP client that fails soft by design, so it is untouched; extending the same parameter to its 4 call sites is a mechanical follow-up if you want it.#115436(merged 2026-08-20) added the current backoff and is an ancestor of the 2026-09-18 failing head, so it is not this failure's owner.Workflow [PR]
Sync PR [sync-upstream/pr/120928]
Version info
26.10.1.145(included in26.10and later)