Skip to content

CI: warn instead of failing the build profile hook when the CI logs cluster does not answer - #126296

Open
groeneai wants to merge 4 commits into
ClickHouse:masterfrom
groeneai:ci-build-profile-hook-warn-on-logcluster-no-answer
Open

groeneai wants to merge 4 commits into
ClickHouse:masterfrom
groeneai:ci-build-profile-hook-warn-on-logcluster-no-answer

Conversation

@groeneai

@groeneai groeneai commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #124531 (comment)
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

On 2026-10-16 Build (arm_release), Build (amd_release) and the warmup build finished OK, but their Post Hooks failed on many pull requests and on master, for example https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=124531&sha=726f6f75887f99e327e188e8dffd2fd2401cf985&name_0=PR&name_1=Build%20(arm_release). From about 10:30 UTC the CI logs cluster writer endpoint gave no HTTP answer at all: every SELECT 1 readiness probe of LogCluster.do_query ended with RemoteDisconnected, the INSERT was never sent, and the assert in insert_profile_data failed the hook. The same runs show Failed to start log export warnings for that endpoint.

is_ready now also records the exception of a probe that got no response headers at all. When every probe of every attempt ended that way (ConnectionError or Timeout), so no INSERT was sent, do_query raises LogClusterUnavailable, and the hook reports it as the workflow warning Build profile not uploaded: the CI logs cluster did not answer and exits 0. Everything else still fails the hook: any HTTP answer to a probe (241, 516, a headerless 503, headers whose body stalls, a redirect whose target does not answer), a failed or rejected INSERT, a missing secret, a broken profile producer (required artifacts are checked before any upload). binary_sizes.txt is uploaded last, so a commit whose upload stopped this way never becomes a Build profile diff baseline. The lost upload is not silent (the concern in #108294): the warning shows on the job and workflow report. No retries are added. An HTTP answer can be a rotated password. select is unchanged, including its probe classification from #128067 and #129675.

Validated locally against a stub endpoint vs master (no test for CI infrastructure): in 36 do_query/select cases and 27 end-to-end hook runs, only the cases where nothing answered (closed without response, read timeout, refused) changed, from exit 1 to exit 0 with the warning.

🤖 Generated with Claude Code


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

…luster does not answer

The build profile hook failed `Post Hooks` of green release builds whenever
the CI logs cluster writer endpoint gave no HTTP answer at all (2026-10-16:
every `SELECT 1` readiness probe ended with `RemoteDisconnected`). `do_query`
then returned False without sending the INSERT, and the bare `assert` in
`insert_profile_data` turned it into `AssertionError` and exit 1.

`is_ready` now keeps the exception of its probe. When every probe of every
attempt raised a `requests` `ConnectionError` or `Timeout`, i.e. nothing
answered and no INSERT was sent, `do_query` raises `LogClusterUnavailable`.
`build_profile_hook.check()` reports that as a workflow warning and exits 0.

Everything else still fails the hook: any HTTP answer to a probe (241, 516,
a headerless 503, a non-JSON 200), a mixed probe run, an INSERT that failed
or was rejected, a missing or unreadable secret, a broken profile producer.
`binary_sizes.txt`, the completion marker the build profile diff uses to pick
its baseline, is uploaded last, so a commit whose upload stopped here never
becomes a baseline. The warning keeps the lost upload visible on the job and
workflow report, as the log export already does for the same endpoint.
No retries or backoff are added.

Related: ClickHouse#124531 (comment)

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; 0 findings), plus my own review of the same head (2 notes).

# Sev Finding Verdict Evidence / action
1 💡 The description did not say that select (read path) keeps LogClusterNotReady on this shape AGREE, fixed in the description one sentence added; no code change
2 💡 requests ConnectionError also covers DNS and TLS failures, so a writer URL pointing at a dead host would warn instead of failing AGREE, noted, not blocking accepted for the transport-only class; a rotated password (403 + 516) or a missing secret still fails the hook

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are
terminal per finding. Findings on hunks unchanged by the fix round are auto-dropped.

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

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. A local stub endpoint that reads each request and closes the connection without a response reproduces the CI log of the cited run on master on every run (8x RemoteDisconnected + WARNING: LogCluster not ready, then ERROR: LogCluster not ready) and the same traceback (build_profile_hook.py:296 -> :245 -> :289 -> log_cluster.py:536, AssertionError, exit 1).
b Root cause explained? The writer endpoint gives no HTTP answer, so every SELECT 1 probe of do_query raises, do_query returns False without sending the INSERT, the bare assert in insert_profile_data raises, and check() turns any exception into exit 1: a red Post Hooks on a green build.
c Fix matches root cause? Yes. do_query, the only place that knows no probe was answered and no INSERT was sent, raises LogClusterUnavailable; the hook turns that one case into a workflow warning and exit 0. No retries or backoff added.
d Test intent preserved / new tests added? No committed test: CI infrastructure only (no tests for the test infrastructure, #119766). Validated with a local stub: 18 do_query/select cases and 10 end-to-end hook runs, master vs this change.
e Both directions demonstrated? Yes. Master: exit 1 with the CI traceback. This change: exit 0, warning Build profile not uploaded: the CI logs cluster did not answer read back through _Environment.get().REPORT_MESSAGES. Three identical runs.
f Fix is general across code paths? do_query is the only INSERT transport and serves all three insert_* uploads (one case stops at the second upload and still warns). The read path (select) is unchanged on purpose.
g Fix generalizes across inputs (params/datatypes/wrappers)? Transport shapes covered: connection closed without response, read timeout, connection refused. Every HTTP answer to a probe (241, 516, headerless 503, 200 non-JSON), a mixed run, INSERT failures, retries 0/1/2/8 and missing secrets keep the old result.
h Backward compatible? (maintainer-approved exception only) CI script only, no setting, format or job config. The one behaviour change is the no-answer case, requested on #124531.
i Invariants and contracts preserved? binary_sizes.txt (the completion marker) is still uploaded last, so an upload that stops on LogClusterUnavailable never makes the commit a baseline (checked: one INSERT, no binary_sizes). is_ready still returns a bool; producer checks, server verdicts and secret failures still fail the hook.

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

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @maxknv, could you review this? When no readiness probe of the build profile upload gets any HTTP answer (the writer endpoint was down on 2026-10-16), the hook now reports a workflow warning and exits 0 instead of failing Post Hooks on a green build; every HTTP answer, a failed INSERT, a missing secret or a broken producer still fails it, and no retries are added (your #108294 concern).

@clickhouse-gh

clickhouse-gh Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f69e052]

Summary: ✅


AI Review

Summary

Reviewed commit f69e052e90c7ba371b5a911d3ea5fe2fc81e6c0a. The PR reports a workflow warning when every build-profile readiness probe fails without an HTTP response, while preserving failures for HTTP answers, failed uploads, missing secrets, and broken producers. Both previous findings are addressed: response headers are recorded before body reads, and required artifacts are validated before uploads. No new findings. Local verification passed 38 base/head transport executions, 11 select comparisons, and 76 hook scenarios. Full CI is still running.

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 17, 2026
Comment thread ci/jobs/scripts/log_cluster.py Resolved
…ducer during an outage

Two holes in the warning path for a CI logs cluster that does not answer:

`requests.post` reads the whole body before it returns, and a read timeout
on the body is raised as a `ConnectionError`, the same type as a refused or
reset connection. It also follows redirects, so the exception can come from
the redirect target after the endpoint answered with a 3xx. A probe whose
headers arrived (for example `403` with exception code `516`, a rotated
password) but whose body stalled, or whose redirect target was unreachable,
was counted as unanswered, and the hook went green with the warning. The
probe now records every response in a `response` hook, which requests runs
once the headers of a response (a redirect included) arrived and before the
body is read; only an exception with no recorded response counts as no
answer. Redirects are still followed.

`_upload_profile_artifacts` checked each required artifact just before its
upload. When the first upload found the endpoint unavailable, a missing or
empty `binary_symbols.txt` or `binary_sizes.txt` was never looked at, and a
broken producer was reported as the outage warning. All required artifacts
are now checked before the first upload; the completion marker is still
uploaded last.

Reported by the clickhouse-gh review on the PR (r4300936551, r4300936554)
and the second-model review (redirects). Validated against a stub endpoint
(headers then a stalled body, a redirect to a refused port and to a working
target, missing later artifacts with a closed and a refused endpoint) with
requests 2.31 and 2.32.5, and against a real local server.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Oct 17, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 04beff9

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, sequential) / 03821_drop_workload_during_query_race flaky, not from this PR (it changes only ci/jobs/scripts/log_cluster.py and build_profile_hook.py): having exception in stdout, the INVALID_SCHEDULER_NODE stack of RequestQueue::enqueueRequest under CPULeaseAllocation after a racing DROP WORKLOAD; 1 of 36 reruns failed; seen on 36 other PRs and master since 2026-10-16 15:02Z #126345 (mine, open)
Performance Comparison (arm_release, master_head, 6/6) / insert_statistics_uniq_v2 #4 not from this PR (no product code in the diff): ALTER ... MATERIALIZE STATISTICS ALL with mutations_sync = 1, client time 0.145 s -> 0.193 s (+33.7%, +62.6% after the restart), dashboard regression kept as blocking; the same query is slower or unstable on 19 PRs and master nightly runs on 2026-10-17 and reds 2 other unrelated PRs a fix task is created (investigating at full effort, fixing-PR link to follow here)
Mergeable Check, PR praktika rollups of the rows above #126345 and the fix task above (the owners of the rows above)
Sync - CH Inc sync (private, not actionable by me)

Session id: cron:our-pr-ci-monitor:20261017-160007

@groeneai

Copy link
Copy Markdown
Collaborator Author

Fixing PR for the insert_statistics_uniq_v2 #4 perf red in the ledger above: #126505

alexey-milovidov pushed a commit to bacek/ClickHouse that referenced this pull request Oct 19, 2026
…efore measuring

Since 2f07f3f (ClickHouse#122231) `t_materialize_uniq_v2_{i64,f64}` no longer stop
merges, so background merges run while the fill commits its 20 1M-row parts
and keep running during queries #0-#3. Each compared server ends up with its
own layout (CI server logs: 8 servers, 8 layouts, from [6,6,6,1,1] to [20]
million rows). The measured `ALTER ... CLEAR STATISTICS ALL, MATERIALIZE
STATISTICS ALL` runs one single-threaded mutation task per part, so its time
follows the largest part, and the layout lasts the whole job, so the dashboard
confirmation restart reproduces the gap (`confirmed_regression` on unrelated
PRs, e.g. ClickHouse#126296: #4 0.1445 -> 0.1933 s).

Merge both tables into one part in the fill with `OPTIMIZE TABLE ... FINAL
SETTINGS optimize_throw_if_noop = 1` and assert one active part per table with
`throwIf`, as `and_compare_chain_derived.xml` does. Without
`optimize_throw_if_noop` a failed merge assignment only logs and returns
success, leaving a random layout. A table that background merges already
collapsed to one part is still rewritten under FINAL, so the pin never throws
on it. `projection_materialize.xml` measures a mutation over one merged part
the same way and is stable on the same harness.

Validated on the official master release build (26.11.1.120): before, 10
fills gave 5 i64 layouts and a 1.92x spread of #4, and perf.py on two servers
gave right/left 1.249, 0.892, 0.841 in 3 of 5 fills; after, one 20M-row part
per table in 10 of 10 fills, #4/#5 spread 1.029/1.041, and perf.py right/left
within 5% in 5 of 5. Replacing one OPTIMIZE with `SELECT 1` fails the fill.

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

Resolve the conflicts with 4e5129b (ClickHouse#128067) and 1087a07:

- log_cluster.py: master now keeps the classified server answer of a failed
  readiness probe in `probe_error`. The transport exception of a probe that
  got no response at all is stored in that same attribute instead of a
  separate `_probe_error`; `select` only acts on a LogClusterUnavailable
  there, so the read path is unchanged.
- build_profile_hook.py: keep master's artifact list (no symbols upload for
  objects-only builds) and add the LogClusterUnavailable warning branch
  after it.

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

clickhouse-gh Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing f69e052e9 with master c50de3b98 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

6 translation units recompiled, 3 s compile time in total, 6 of them have a recent master baseline.

Job report

…answer

Conflict in ci/jobs/scripts/log_cluster.py with e90fa64, which makes a
readiness probe that timed out after connecting set
`probe_error = LogClusterUnavailable(...)` for `select`.

`probe_error` keeps master's meaning. The transport exception of a probe that
got no response at all moves to its own attribute, `_probe_transport_error`,
which only `do_query` reads. Otherwise a timed-out probe would no longer count
as unanswered on the INSERT path, and `select` would lose the
LogClusterUnavailable that e90fa64 sets.

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

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.

2 participants