Skip to content

CI: classify the CI logs cluster rejecting its readiness probe for memory like a read - #126200

Open
groeneai wants to merge 3 commits into
ClickHouse:masterfrom
groeneai:ci-logcluster-probe-load-rejection
Open

groeneai wants to merge 3 commits into
ClickHouse:masterfrom
groeneai:ci-logcluster-probe-load-rejection

Conversation

@groeneai

@groeneai groeneai commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #120462
Related: #121048

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):

Not required: CI-only change.

Description

Build profile diff went red on 9 pull requests on 2026-10-15, 13:32-14:14 UTC, with LogClusterNotReady: the endpoint never became ready, for example https://github.com/ClickHouse/ClickHouse/actions/runs/38733099660/job/116464087359.

The read-only CI logs endpoint was over its total memory limit, so the server rejected every HTTP query, SELECT 1 included, at the early memory check before authentication: 500 with X-ClickHouse-Exception-Code: 241. On a POST, select already reports that answer as LogClusterUnavailable (green, nothing compared). A run whose 8 readiness probes all got it never posted and ended LogClusterNotReady (red), so one server state gave both colours in the same minute. The probe logged only No connection to LogCluster, as in #120462, so those runs got an answer too.

is_ready stays a bool, but remembers and logs its last non-2xx answer. A run whose probes never passed ends LogClusterUnavailable only when every probe got a load answer (202 or 241 with the exception header); any other failed probe keeps LogClusterNotReady, and a later probe never overwrites it: a missing secret, a transport error, a headerless gateway answer, an authentication failure, any other code. A probe the server rejected for anything but its load also keeps a run red after a read saw an outage. #121048 (comment) offered a follow-up for the SELECT 1-timeout leg; the leg that mattered in practice is the load answer. As the memory check precedes authentication, a rotated password stays hidden only while every probe of a run lands in a memory window.

Validated locally (no test for CI infrastructure): a stub server ran 28 probe/read scenarios against this file and master's, all as expected over three byte-identical runs. A real 26.10.1.1 server with max_server_memory_usage below its idle RSS answered SELECT 1 with 500 + 241: master's select ended LogClusterNotReady, this one LogClusterUnavailable; a wrong password at a normal limit still ends LogClusterNotReady.


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

groeneai and others added 2 commits October 16, 2026 03:17
…mory like a read

While the read-only CI logs endpoint is over its total memory limit, the
server rejects every HTTP query at the early memory check that runs before
authentication (`checkUserNameNotEmptyAndServerHasEnoughMemory` in
`authenticateUserByHTTP.cpp`), `SELECT 1` included: 500 with
`X-ClickHouse-Exception-Code: 241`. `select` already reads that answer on a
POST as `LogClusterUnavailable`, but when every readiness probe of a run got
it, the run never reached a POST and ended `LogClusterNotReady`, so one
server state gave opposite verdicts depending on which request caught it
(2026-10-15 13:32-14:14Z: 9 PRs red, one green by 241 in the same minute).

`is_ready` stays a bool. It now keeps its last non-2xx answer and logs it
through `_classify` instead of "No connection to LogCluster", which hid the
status and code. `select` ends `LogClusterUnavailable` only when every
failed probe was such a load answer (202 or 241 with the exception header);
any other failed probe (no secret, a raising readiness check, a transport
error, a headerless gateway answer, any other code, `1 != 1`) is sticky and
keeps `LogClusterNotReady`, so the causes the ruling on ClickHouse#120288 keeps red
stay red.

Related: ClickHouse#120462

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…read saw an outage

`select` consulted the probes only when no attempt reached its POST. Once a
read had got a load answer (241) or raised at the transport level, a later or
earlier probe that the server rejected for another reason (516 for a rotated
password, any other code, a non-numeric code header) was ignored, and the run
ended `LogClusterUnavailable`, which the build profile diff reports green.

Each failed probe that the server answered with a non-load code is now kept,
and when a read was attempted that verdict is raised after the loop instead of
the read's outage. A probe that got no server answer after a read (transport
error, headerless gateway answer, missing secret) still reads as an outage,
and a run that never reached a read is classified exactly as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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; 2 rounds, 2 findings) plus my own review (two rounds, nits only).

# Sev Finding Verdict Evidence / action
1 ⚠️ A probe the server rejected (e.g. 516) after a read saw an outage still ended LogClusterUnavailable (select) AGREE in part, fixed in e5f34dd A non-load server verdict on a probe now keeps the run red after a read. Not taken: transport or headerless probe failures after a read stay an outage, per the LogClusterUnavailable contract and the #121048 ruling
2 💡 select's docstring does not mention a probe-derived LogClusterQueryError or LogClusterNotReady noted doc only, no behaviour difference
3 💡 Description wording (#121048 offer, validation, #120462 link, length) AGREE reworded and condensed
4 💡 Each failed probe is classified twice (log line, verdict) noted no behaviour difference

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

Session id: cron:clickhouse-review-slot-8:20261016-035600

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. A local HTTP stub answering every SELECT 1 probe with 500 + X-ClickHouse-Exception-Code: 241 makes master's LogCluster.select end LogClusterNotReady after 8 probes and 0 reads, every run (the CI log shape). Also on a real 26.10.1.1 server started below its idle memory.
b Root cause explained? Over the total memory limit, the early memory check before authentication rejects every HTTP query with 241, SELECT 1 included. select maps 241 on a POST to LogClusterUnavailable, but never looked at the probe's answer, so a run whose probes all got 241 ended LogClusterNotReady.
c Fix matches root cause? Yes. The probe's own answer gets the read's classification, only for the load verdicts (202/241 with the exception header). No new green path for any other cause; is_ready stays a bool.
d Test intent preserved / new tests added? No test committed: this is CI infrastructure (no tests for the test infrastructure). Validation is local: 28 stub scenarios, base vs fix, plus the real-server run.
e Both directions demonstrated? Yes. All-241, all-202 and mixed 241/202 probes: master LogClusterNotReady, this PR LogClusterUnavailable, on the stub and (241) on a real server. A probe rejected with 516 or a non-numeric code before or after a read that saw only an outage: master LogClusterUnavailable, this PR LogClusterQueryError. Every other scenario is identical on both.
f Fix is general across code paths? select's never-ready leg now classifies the probes' load answers; after a read, a probe the server rejected for anything but its load keeps the run red. do_query (uploads) keeps failing closed by design, only its log line changes.
g Fix generalizes across inputs (params/datatypes/wrappers)? Codes 241, 202, 516, 194, 164, a non-numeric header, no header; 401/403/500/503; connection refused and probe timeout; missing secret; hard-first and hard-last mixes; recovery after both kinds; a server-rejected probe before and after a read, and the read budget; retries=0.
h Backward compatible? (maintainer-approved exception only) Yes. CI script only; no setting or format. Callers see a changed log line and, only when every probe was a load rejection, LogClusterUnavailable instead of LogClusterNotReady; when the server rejected a probe for anything but its load in a run whose reads saw only an outage, LogClusterQueryError instead of LogClusterUnavailable.
i Invariants and contracts preserved? is_ready returns a bool on every path and resets the remembered answer first, so a raising or secret-less call never leaves a stale one. A hard probe failure is never overwritten in a run that never reached a read, and a probe the server rejected is never overwritten by a read's outage. select still returns the body or raises a LogClusterError on every path.

Session id: cron:clickhouse-impl-slot-40:20261016-034000

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @alexey-milovidov @leshikus, could you review this? When every readiness probe gets the memory-limit rejection (500 + X-ClickHouse-Exception-Code: 241, raised before authentication), select now ends LogClusterUnavailable like a read with the same answer, and every other probe failure keeps LogClusterNotReady; is_ready stays a bool.

@clickhouse-gh

clickhouse-gh Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [46d2cbe]

Summary: ✅


AI Review

Summary

Reviewed PR #126200 at 46d2cbee7e36fa9028bff0cd07c3fc973fa3ea93. Readiness probes rejected with load codes 202 or 241 can now produce LogClusterUnavailable, while other probe failures retain the documented failure behavior. No actionable findings. A throwaway harness passed 138 scenarios against both the base and PR versions using mocked HTTP responses, covering mixed failures, recovery, read budgets, state reset, secret failures, and upload behavior.

Final Verdict

Status: ✅ Approve.

@clickhouse-gh clickhouse-gh Bot added pr-ci comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). labels Oct 16, 2026
@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Oct 16, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Commit 46d2cbee7e36fa9028bff0cd07c3fc973fa3ea93 was not compared: the CI logs cluster did not answer (exception 241, code 500: Code: 241. DB::Exception: (total) memory limit exceeded: would use 213.13 …).

See the job log for details.

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - e5f34dd

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
Stress test (arm_asan_ubsan, s3) / Server unresponsive: memory limit exceeded not from this PR (it changes only ci/jobs/scripts/log_cluster.py): the server reached its 42.92 GiB RSS cap (Code: 241 in a background merge at 42.93 GiB RSS); the same shape hit 7 other PRs in the asan stress lanes since 2026-10-12 a fix task is created (investigating at full effort, fixing-PR link to follow here)
Mergeable Check, PR rollups of the row above a fix task is created (the owner of the row above)

Session id: cron:our-pr-ci-monitor:20261016-103005

@groeneai

Copy link
Copy Markdown
Collaborator Author

Fixing PR for the Stress test (arm_asan_ubsan, s3) red (and its Mergeable Check / PR rollups): #125706.

It is not RSS drift: the log stops at 53.1 GiB RSS (container limit 53.65 GiB) while a failed secondary of 04035_url_cluster_callback_cancel_race was copying its 2.1 MB pipeline-dump exception into each of its ~26k processors_profile_log rows. The S3 server was gone after that as well, so the post-stress restart never became ready.

This branch has not been deployed

No deployments
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). manual approve Manual approve required to run CI pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants