Skip to content

Skip the targeted job when CIDB is unavailable during test selection - #125613

Merged
leshikus merged 4 commits into
ClickHouse:masterfrom
groeneai:ci-cidb-timeout-through-previously-failed-lookup
Nov 24, 2026
Merged

leshikus merged 4 commits into
ClickHouse:masterfrom
groeneai:ci-cidb-timeout-through-previously-failed-lookup

Conversation

@groeneai

@groeneai groeneai commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #122111
Related: #114730

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

A targeted stateless or integration job is now skipped, not errored, when a test-selection read times out in the CI database, the CI database rejects it for lack of server memory, or the connection is still refused after 3 minutes of retries.

Description

#122111 made the targeted stateless and integration jobs SKIPPED instead of ERROR when a test-selection CIDB request times out (CIDBTimeoutError). Three cases still errored the job:

  1. The strict previously-failed lookup (Targeting.get_previously_failed_tests_with_info(strict=True), from CI: run only the selected tests in the sanitizer functional tests in PRs #114730) re-wrapped any exception as a plain RuntimeError. It now re-raises CIDBTimeoutError unchanged. Example: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118823&sha=d7096796fc6d931e090a176efa3a8f48ad84b581&name_0=PR&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20distributed%20plan%2C%20targeted%29
  2. CIDB._post_with_retries decides from the last attempt only. An overloaded server alternates timeouts with HTTP 500 (total) memory limit exceeded (the server-wide limit). On 2026-10-17, 14 targeted jobs on 14 PRs ended on such a 500 and errored, for example https://s3.amazonaws.com/clickhouse-test-reports/PRs/113336/7df483dd0c5ea714abd24f66bbcd217889c9ecf5/pr/stateless_tests_amd_asan_ubsan_db_disk_distributed_plan_targeted/job.log. That answer now counts as an overload, like a timeout.
  3. A refused connection (the 2026-10-13 CIDB outage) errored the job after 5 attempts, about 30 s. As requested in review, the selection client now retries it for up to 3 minutes, then skips. Other CIDB clients keep the old behaviour (refused_retry_sec is 0 by default). Only Connection refused counts, not SSL, proxy or DNS errors.

A per-query or per-user memory limit and any other error answer still error the job, also when a later attempt times out. The targeted AST fuzzer reads through the same client, so in an outage its two best-effort reads also wait up to 3 minutes each before falling back.

Validation, local, through the real CIDB and Targeting with mocked requests.post, a fake clock and real local sockets: every case above raises RuntimeError on master and CIDBTimeoutError with this change; on a closed port the strict lookup skips after 180 s; a server that comes back inside the window is used; the other answers stay RuntimeError; test_selection_smoke passes.


Workflow [PR]
Sync PR [sync-upstream/pr/125613]

Version info

  • Merged into: 26.12.1.418-master (included in 26.12 and later)

…ted job

ClickHouse#122111 made the targeted stateless and integration jobs SKIP instead of
ERROR when a test-selection CIDB request times out on every attempt
(`CIDBTimeoutError`). The first selection read, the strict previously-failed
lookup in `Targeting.get_previously_failed_tests_with_info`, re-wrapped any
exception as a plain `RuntimeError`, so a timeout there lost its class
before reaching either `except CIDBTimeoutError` handler and the shard
still ERRORed ("Failed to load test selection" in the stateless job, an
uncaught exception in the integration job). On a `pr-bugfix` PR that drops
`Bugfix validation` and fails `Finish Workflow / Post Hooks`.

Re-raise `CIDBTimeoutError` unchanged in strict mode. Every other failure
(a refused connection, an answered non-OK response) stays wrapped and keeps
failing the job, as ClickHouse#114730 intends. Best-effort mode is unchanged.

CIDB shows 3 such errors, all on 2026-09-24/25 during the CIDB overload
ClickHouse#122111 targets (PRs ClickHouse#118823, ClickHouse#117436, ClickHouse#114865).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect labels Oct 13, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 1 finding; 1 full pass on the published head).

# Sev Finding Verdict Evidence / action
1 ⚠️ test_selection_smoke would still pass if the change were reverted; add a case for the strict lookup DISAGREE No in-tree test for test-infrastructure code (maintainer decision on #119766). Validated locally in both directions: on master a read timeout surfaces as a plain RuntimeError for both job types; with the change it stays CIDBTimeoutError.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal per finding.

Session id: cron:clickhouse-review-slot-9:20261013-114500

@groeneai
groeneai requested a review from maxknv October 13, 2026 12:16
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Oct 13, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [dc8df22]

Summary: ✅


AI Review

Summary

Reviewed #125613 at dc8df2284e01fe022a3a9c16f17c8d1ccc8dfdef. The change preserves CIDBTimeoutError through the strict lookup, treats server-wide memory exhaustion as unavailability, and retries refused selection connections for three minutes before skipping the targeted job. No actionable findings. Validation passed 18 selection smoke tests and 18 focused checks covering retry timing, recovery, error classification, and exception propagation.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Oct 13, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Oct 13, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 3769368

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Stateless tests (arm_binary, s3 storage, DBReplicated, parallel, 2/2) / 04034_autopr_min_rows_per_replica_reuses_index_analysis flaky, not from this PR (it only changes ci/jobs/scripts/find_tests.py): pr_used 1 -> 0 for the queries that reuse the collected statistics, 1/46 on rerun with the same settings. The automatic parallel replicas cost gate compares the compressed read size with the output estimate, and the compressible table makes the outcome noisy. Same signature on 3 other PRs in 30 days #125544 (mine, open)
Mergeable Check, PR praktika rollups of the row above #125544 (mine, open)

CIDB has no other FAIL or ERROR row on this head.

Session id: cron:our-pr-ci-monitor:20261013-153004

…rgeted job

`_post_with_retries` picks the exception from the last attempt only. An
overloaded CIDB server times out some requests and rejects others with
`(total) memory limit exceeded` (the server-wide limit), alternating between
attempts of one request. Only a final client timeout raised
`CIDBTimeoutError`, which the targeted jobs turn into SKIPPED, so the job's
verdict depended on which symptom the fifth attempt happened to see.

On 2026-10-17 at 05:28-05:31Z, 14 targeted stateless jobs on 14 PRs saw
`M, M, T, M, M` or `T, M, T, M, M` (T = 60 s read timeout, M = HTTP 500
`(total) memory limit exceeded ... maximum: 327.61 GiB`) and ended ERROR
with no test run. A job from the same wave saw the same mix and passed on
the fifth attempt. The failing read, the coverage canary seed query, peaks
at about 3.2 GB, so the overload was not caused by the selection itself.

Treat an answer reporting the server-wide memory limit like a client
timeout. Per-query and per-user memory limits (`Query`/`User memory limit
exceeded`), refused connections and every other non-OK answer stay errors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai changed the title Skip the targeted job when the previously-failed tests lookup times out in CIDB Skip the targeted job when CIDB is overloaded during test selection Oct 17, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review of the new commit by an independent model (engine: codex; 1 finding; 1 full pass on the published head) plus my own review (2 nits).

# Sev Finding Verdict Evidence / action
1 ⚠️ test_selection_smoke would still pass if the overload classification or the strict re-raise were reverted DISAGREE No in-tree test for test-infrastructure code (#119766). Validated locally: the verbatim 2026-10-17 500 body is RuntimeError on master and CIDBTimeoutError here, through both selection reads and a real socket; reverting the overload line brings RuntimeError back.
2 💡 The skip text in both handlers still says "timed out" when the cause is an out-of-memory answer noted The appended exception text carries the server's real message; left as is to keep the diff minimal.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal per finding.

@fm4v

fm4v commented Oct 17, 2026

Copy link
Copy Markdown
Member

@groeneai no, add retries up to 3 minutes, then skip.

…then skip

A refused connection during test selection errored the targeted job after
5 attempts (about 30 s). As asked on ClickHouse#125613, the selection client now
retries a refused connection for up to 3 minutes and then raises
`CIDBTimeoutError`, so the targeted stateless and integration jobs skip
instead of erroring. Other CIDB clients keep the old behaviour
(`refused_retry_sec` defaults to 0). Only `Connection refused` counts;
SSL, proxy and DNS errors stay fatal.

A request that got an error answer other than the server-wide memory limit
on any attempt now always raises `RuntimeError`: a later timeout, overload
or refusal no longer turns it into a skip.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai changed the title Skip the targeted job when CIDB is overloaded during test selection Skip the targeted job when CIDB is unavailable during test selection Oct 17, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

Done in cafb502: during test selection a refused connection is now retried for up to 3 minutes, then the targeted job skips. Other CIDB clients still fail after 5 attempts, and a request that got any other error answer still errors the job.

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - cafb502

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Stateless tests (arm_binary, s3 storage, DBReplicated, parallel, 1/2) / 04034_autopr_dataflow_cache_reuse_between_different_queries flaky, not from this PR (it changes only the CI test selection scripts): pr_used 1 -> 0 for queries 1 and 2, 1 of 43 reruns with the same settings failed; it failed on 4 other PRs and on master in the last 3 days #125544 (mine, open)
Mergeable Check, PR praktika rollups, red only because of the row above #125544 (the owner of the row above)

All check runs completed and Finish Workflow is green. CIDB has no other FAIL or ERROR row on this head.

Session id: cron:our-pr-ci-monitor:20261018-020007

This was referenced Oct 18, 2026
…ough-previously-failed-lookup

Resolve the conflict in get_previously_failed_tests_with_info: the strict
lookup re-raises both CIDBTimeoutError (this PR) and GitHubUnavailableError
(ClickHouse#126783), so the targeted job skips when either CIDB or GitHub is unavailable.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@leshikus leshikus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@leshikus
leshikus added this pull request to the merge queue Nov 24, 2026
Merged via the queue into ClickHouse:master with commit 8bd61d0 Nov 24, 2026
179 checks passed
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect manual approve Manual approve required to run CI pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants