Repository navigation
CI: "Build profile diff" is green when the CI logs cluster does not answer - #121048
Conversation
…nswer The check's only data source is the CI logs cluster, which is shared by the whole CI fleet: it has minutes-long windows where every query fails with Code 241 (server-wide memory pressure), plus the usual endpoint, credential and transport outages. A read that never got an answer measured nothing about the pull request, so failing the check reported an outage of an unrelated service as a problem with the change under test. `LogCluster.select` now tells the two failure kinds apart instead of returning `None` for both: `LogClusterQueryError` when the cluster answered by rejecting the query (4xx - bad SQL, a missing table, denied access) and `LogClusterUnavailable` when it never answered it (5xx on every retry, every POST raising, or the endpoint never becoming ready, including a failed AWS SSM lookup of the endpoint or the password). On `LogClusterUnavailable` the job now completes green with an explanatory info line, and refreshes its pinned pull request comment so that an earlier commit's comparison is not left standing as if it described the head. Every other path is unchanged and still fails the job: a rejected query, a missing master baseline, an unresolved build run.
|
Workflow [PR], commit [0c06b18] Summary: ✅
AI ReviewSummaryThis PR makes Findings❌ Blockers
Final Verdict❌ Changes requested. The broad transient-code whitelist can still convert real reporting-query failures into a green check. LLVM Coverage Report |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline. |
|
The last raise in class LogClusterNotReady(LogClusterError):
"""The endpoint never became ready.
A readiness probe that never answers is indistinguishable from a rotated
password or a deleted SSM parameter, and completing green on that would
blank the check fleet-wide for as long as the condition lasts.
""" # Every attempt gave up before its POST: `is_ready()` was false for all
# of them.
raise LogClusterNotReady("the endpoint never became ready")
One cause that classification pulls in with it, worth naming because it is the live incident: I am not pushing to your branch: take the patch here, or say so and I will send it as a follow-up PR as soon as this one lands. One ask from @ azat's review of #118708 that closes with it: an error the server reports after committing a |
|
🕵 Your reading of the second finding is adopted, in a follow-up rather than here: this pull request merged as
I kept your "free either way" framing in the commit message: whether that cluster's readonly profile can produce a Verified with a throwaway harness (not committed):
|
`LogCluster._classify` treated exception codes `159` (`TIMEOUT_EXCEEDED`)
and `209` (`SOCKET_TIMEOUT`) as `LogClusterUnavailable`, so they reached
`main`'s green handler in `ci/jobs/build_profile_diff_job.py` and
reported the check `OK`.
Both are the server's verdicts on a query it accepted, not statements
about the shared cluster's load, and `_classify` is reached from `select`
only - `is_ready` posts its own constant `SELECT 1` and returns a bool
without consulting the set, and `do_query` retries on the status. So the
only path the two codes affected is the reporting `SELECT`s, and there a
query that regressed into a server-side timeout was retried eight times,
classified as an outage, and hidden behind a green check - exactly what
the contract of `report_cluster_unavailable` excludes.
They bought nothing for the outage that motivated the green path either:
that shape returns no response at all (`ReadTimeout`), which leaves
through the transport handler and is `LogClusterUnavailable` whatever the
set contains.
`TRANSIENT_EXCEPTION_CODES` is now `{202, 241}` - too many simultaneous
queries, and the server-wide memory-pressure windows - both verdicts
about the cluster's own load, and both observed rather than inferred.
Verified with a throwaway harness (not committed - we have no automated
tests for the CI scripts): `159` and `209` now classify as
`LogClusterQueryError` and raise after exactly one POST, `202` and `241`
still classify as `LogClusterUnavailable` and exhaust the eight retries,
a headerless `502`/`503` is still `LogClusterUnavailable`, a non-numeric
header value still falls closed, and `164`, `158`, `62` and `60` are
unchanged.
Follow-up to ClickHouse#121048,
addressing the review finding left unresolved there.
Related: ClickHouse#121048
Related: ClickHouse#118708
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… wall clock `Build profile diff` is SIGKILLed at its 1800 s job timeout while retrying CI logs cluster reads, so it reds a pull request for an outage of an unrelated shared service and reports no reason at all. LogCluster.select bounds a read by attempt count only (retries=8, timeout=60, plus a 5+10+...+40 = 180 s backoff, so about 684 s worst case for one read, and requests' timeout bounds one socket read rather than the request, so a trickling connection was measured at 185 s for a single attempt). It is never bounded by wall clock, while build_profile_diff_job.py issues 16 db.query reads inside a job whose timeout is 1800 s. Three degraded reads exhaust the window, praktika SIGTERM/SIGKILLs the process, and select never returns and never raises: Db.query cannot propagate, main()'s except LogClusterUnavailable never runs, and the green report_cluster_unavailable completion added in ClickHouse#121048 is unreachable in exactly the window it was written for. The kill also skips update_comment, leaving the comparison comment of an earlier commit of the same pull request in place as if it were the current one. Observed on PR ClickHouse#96662 at head 72541f0, which already contains ClickHouse#121048 and ClickHouse#121393: 18 requests.exceptions.ReadTimeout, zero "LogCluster not ready", and the job killed exactly 1800 s after its process started with no Result at all. Reads were succeeding in between, so the job was crawling at about 420 s per read rather than blocked, which is why the budget is shared across the job's reads instead of applied to each one. A LogCluster instance now takes an optional read budget (default None, so every other caller is unchanged) and select gains one guard at the top of its retry loop, on a spent budget AND a POST already attempted. Both conditions are load-bearing rather than conveniences, for the same reason: the post-loop discriminator is defined by what the attempts did, so any read that leaves the loop having attempted no POST classifies as LogClusterNotReady (red) even though the cluster was answering. Exempting attempt 0 covers the read that starts after the deadline; requiring post_attempted covers the read whose first readiness probe fails transiently, which would otherwise break at the second iteration with nothing attempted. So the budget stops POST retries only, and the readiness schedule, which exists because is_ready fails during the same pressure spikes as the query itself, always keeps its full count. The added cost is bounded and paid at most once per job: a read that never becomes ready spends 8 probes plus the 180 s backoff, about 204 s, and then ends the job. No new green path appears, LogClusterNotReady stays red and TRANSIENT_EXCEPTION_CODES is untouched, so both the rule that only "the cluster never answered" is green and ClickHouse#121393's narrowing that keeps 159 and 209 hard continue to hold. The number is derived from the job's own configured timeout via Info().job_config, following stateful_prep_step_timeout in ci/jobs/functional_tests.py, minus a fixed reserve of 550 s, so 1250 s at the current timeout=1800. The reserve is fixed rather than a fraction because every component of it is independent of the timeout: interpreter startup before the first read, one in-flight POST overrunning its 60 s socket timeout, one already-started backoff, and the reporting tail. The docker image pull is not charged to it, because job.timeout only starts with the job process. Applied to the ClickHouse#96662 timeline the read raises at about 13:21:20 instead, 8.5 minutes before the kill, and the check completes green with the reason and a refreshed comment. The failed-attempt spacing there (65/70/75/80/86/90 s, the 60 s socket timeout plus 5*(retry+1)) identifies the 13:20:43 failure as the seventh attempt of that read, so the guard is next reached after its 35 s backoff; 13:23:14 is the first attempt of the following read, which the change never reaches. Validated against a local HTTP stub over three runs with identical classifications, with a control on the pre-change file that matches wherever no budget is passed, with assertions on the derivation keyed on the real JobConfigs.build_profile_diff_job.timeout, and with a case that pins the readiness behaviour: a spent budget plus one transient probe failure returns the body, while the same case without the post_attempted condition raises LogClusterNotReady. Co-Authored-By: Claude Opus 5 <[email protected]>
… logs cluster outage When the read-only sub-service of the CI logs cluster stops answering, every `SELECT 1` readiness probe of `LogCluster.select` raises `requests.exceptions.ReadTimeout`. `is_ready` turned that into a bare False without a `probe_error`, so `select` raised `LogClusterNotReady`, which `build_profile_diff_job.main` does not catch, and the check went red on unrelated PRs (8 of them on 2026-11-06 between 00:00Z and 02:52Z, e.g. job 127646247697 of ClickHouse#129611). The same outage hitting a POST already ends `LogClusterUnavailable` (ClickHouse#121048), and so does a probe the server rejects with 241 (ClickHouse#128067). A probe that raises `ReadTimeout` now records `LogClusterUnavailable` in `probe_error`, and the tail added by ClickHouse#128067 reports the read green as "the endpoint never became ready: the readiness probe timed out: ...". The last probe decides, as there. A `ReadTimeout` (requests 2.33.0, the CI pin) is raised only after the name resolved and a server accepted the connection: a stalled TLS handshake or a stalled answer. Connection refused, an unresolvable name, no SYN-ACK and a certificate mismatch raise `ConnectionError` (`ConnectTimeout` and `SSLError` are subclasses), and the server itself rejects a rotated password with 516. All of those, a missing secret and a gateway answer still end `LogClusterNotReady`, as ruled on ClickHouse#120288. This is the `SELECT 1`-timeout leg left open on ClickHouse#121048. Validated with a throwaway harness against master (real sockets, mocked transport and `main()` end to end); only the probe-timeout cases change. No test is committed for the CI scripts (ClickHouse#119766). Co-Authored-By: Claude Opus 5.5 <[email protected]>
The "Build profile diff" check reads everything it reports from the CI logs cluster, which is shared by the whole CI fleet. That cluster has minutes-long windows where it answers nothing (server-wide memory pressure,
Code 241for every query), plus the usual endpoint, credential and transport outages. A read that never got an answer measured nothing about the pull request, so failing the check reported an outage of an unrelated service as a problem with the change under test.LogCluster.selectnow tells the two failure kinds apart instead of returningNonefor both:LogClusterQueryError- the cluster answered by rejecting the query (4xx: bad SQL, a missing table, denied access). A defect no retry can fix; it must stay visible.LogClusterUnavailable- the cluster never answered (5xx on every retry, every POST raising, or the endpoint never becoming ready, including a failed AWS SSM lookup of the endpoint or the password).On
LogClusterUnavailablethe job completes green with an explanatory info line, and refreshes its pinned pull request comment so that an earlier commit's comparison is not left standing as if it described the head. Green asOKrather thanSKIPPED: both are green, but the report greys out a skipped job and drops the link to its own report, and for an outage the job log is the whole diagnostic.Everything else is unchanged and still fails the job: a rejected query, a missing master baseline, an unresolved build run.
Verified with a throwaway pytest suite (not committed, since
ci/testswas removed from the repository) covering bothselectclassifications - 5xx, transport exception, never-ready endpoint, failed secret lookup, 4xx, success - andmainend to end: an outage at the first query and at the baseline lookup exits 0 with anOKresult, while a rejected query and a missing baseline still raise.Changelog category (leave one):
Workflow [PR]
Sync PR [sync-upstream/pr/121048]