Skip to content

Retry the build-profile telemetry INSERT through the CI logs cluster memory-pressure spikes - #113409

Merged
alexey-milovidov merged 1 commit into
masterfrom
logcluster-insert-retry-backoff
Aug 6, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
logcluster-insert-retry-backoff

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Aug 5, 2026 •

Copy link
Copy Markdown
Member

Since 2026-08-03, the Post Hooks step of Build (arm_release) (and other profiled build variants) fails fleet-wide — 354/468 runs on 2026-08-03 and 456/528 on 2026-08-04, on PRs and master alike. The build-profile telemetry INSERT into the shared CI logs cluster is rejected with HTTP 500, Code 241 MEMORY_LIMIT_EXCEEDED ("User memory limit exceeded ... OvercommitTracker decision: Query was selected to stop"), and build_profile_hook.py (correctly) fails closed. The wave started right after #111164 began uploading reduced build profiles for every PR build, multiplying the INSERT rate against the writer endpoint.

LogCluster.do_query (the INSERT transport) made a single attempt (retries=1), while select in the same file already retries 8 times with a growing backoff — its comment documenting exactly these "minutes-long server-wide memory-pressure spikes (Code 241 for every query)". This PR retries the three profile INSERTs on the same schedule, and rewinds a file-like body before every attempt: requests consumes the stream on the first POST, so re-sending the exhausted stream would run an INSERT with an empty body — a "success" with the telemetry silently lost. 4xx rejections still stop after the first attempt, and the fail-close assert stays, so a genuinely lost upload still fails the job.

Unit tests cover the retry-with-rewound-body behavior and the no-retry-on-4xx behavior in ci/tests/test_build_profile_hook.py.

Note this is a mitigation for the transport; the writer endpoint's inflated per-user memory accounting ("would use 2.50 TiB", cap 29.80 GiB) likely also needs infra attention — see the issue.

Example report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=109496&sha=latest&name_0=PR&name_1=Build%20(arm_release)
Related: #113408
Related: #111164

Changelog category (leave one):

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

Version info

  • Merged into: 26.8.1.876 (included in 26.8 and later)

…memory-pressure spikes

Since 2026-08-03, the `Post Hooks` step of `Build (arm_release)` fails on
75-86% of all runs, PRs and master alike: the telemetry INSERT into the
shared CI logs cluster is rejected with HTTP 500, Code 241
`MEMORY_LIMIT_EXCEEDED` ("User memory limit exceeded ... OvercommitTracker
decision: Query was selected to stop"), and `build_profile_hook.py` fails
closed. The wave started when #111164 began uploading reduced build
profiles for every PR build, multiplying the INSERT rate.

`LogCluster.do_query` made a single attempt (`retries=1`), while `select`
in the same file already retries 8 times with a growing backoff, its
comment documenting exactly these minutes-long Code 241 pressure spikes.
Retry the INSERT transport on the same schedule, and rewind a file-like
body before every attempt: requests consumes the stream on the first POST,
and re-sending the exhausted stream would run an INSERT with an empty body
- a success with the telemetry silently lost. 4xx rejections still fail
after the first attempt, and the fail-close `assert` stays.

Example report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=109496&sha=latest&name_0=PR&name_1=Build%20(arm_release)
Related: #113408

Co-Authored-By: Claude Fable 5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [71b2e71]

Summary: ✅


AI Review

Summary

This PR retries build-profile telemetry uploads on transient 5xx responses and rewinds file-like bodies between attempts, but the writer-path readiness probe is still a one-shot SELECT 1 against the same endpoint. Because that probe runs before the retry loop, the upload can still fail on the first memory-pressure spike the PR is meant to ride out, so I cannot approve it yet.

Findings

❌ Blockers

  • ci/jobs/scripts/log_cluster.py:88-90 The upload contract here is "retry through transient CI logs cluster pressure", but do_query still calls is_ready once before entering the new retry loop. is_ready is itself a SELECT 1 to the same writer endpoint, so the same Code 241 / connection spike can make do_query(..., retries=8) return False before any retried POST happens. A minimal repro is is_ready = [False, True, ...]: the current code stops after the first False. Move the readiness probe into the retry loop (or retry it on the same backoff) so transient probe failures do not bypass the upload retries.
Tests
  • ⚠️ Add a focused regression test where is_ready fails once and then succeeds, proving do_query(..., retries=8) reaches a later successful POST instead of returning immediately.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions: retry the readiness probe on the same schedule as the upload POST path instead of returning immediately on the first failed is_ready, and add the focused regression test for that path.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 5, 2026
Comment thread ci/jobs/scripts/log_cluster.py Resolved
This was referenced Aug 5, 2026

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I doubt it will help, but the change is reasonable - let's try.

This was referenced Aug 6, 2026
larryluogit pushed a commit to ClibMouse/ClickHouse that referenced this pull request Aug 9, 2026
`LogCluster.do_query` probed `is_ready` once, before its retry loop. That
probe is a `SELECT 1` against the same writer endpoint as the INSERT, so
it fails during exactly the memory-pressure spikes (Code 241 for every
query) that the retries added in ClickHouse#113409 exist to ride out: a single
transient failure of the probe abandoned the upload before any `POST`
was attempted, and `build_profile_hook.py` failed the build job closed.

Move the probe into the retry loop, on the same growing backoff `select`
already uses for it, and report the never-became-ready case explicitly so
the fail-close assert is not the only thing in the log.

Follow-up to ClickHouse#113409
Related: ClickHouse#113408
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants