Skip to content

Throttle reading in the first subtest of 05238_pretty_squash_broken_pipe - #125102

Merged
alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
groeneai:throttle-05238-pretty-squash-first-subtest
Oct 11, 2026
Merged

alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
groeneai:throttle-05238-pretty-squash-first-subtest

Conversation

@groeneai

@groeneai groeneai commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #117005

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

...

Description

05238_pretty_squash_broken_pipe (added by #117005) fails in Fast test (arm_darwin) in 12 of 320 runs, on 12 unrelated PRs, always in its first subtest: Unexpected exit code 241 (MEMORY_LIMIT_EXCEEDED) 1-3 s after the subtest starts (#124727), or the 60 s timeout with head -n 1 still waiting for its first line (#118942).

With a non-zero output_format_pretty_squash_consecutive_ms, PrettyBlockOutputFormat only appends blocks until the producer pauses for 50 ms, and numbers(1e18) never pauses. So the first table holds everything read before the background thread first writes, and because the test raises output_format_pretty_max_rows to 1e12, the whole table is rendered before its first byte reaches the pipe. Its size is throughput times the time to the first write (17.7M-19.3M rows here); on the macOS runner it is not rendered within 60 s or grows past the memory limit.

The subtest now reads at most 1M rows/s (max_execution_speed, with timeout_before_checking_execution_speed=0 because the throttle is otherwise off for the first 10 s). The source then sleeps longer than the 50 ms squash window after each block, so every table is one block. The subtest still writes every block into the broken pipe and must stop with exit code 75. The format is unchanged: only the test's own output_format_pretty_max_rows=1e12 makes the first table this expensive to render.

Validation on Linux (macOS only through this PR's CI):

  • Late first write emulated with a 10 s squash window and a 4 GiB cap: before 241 in 1.2 s (3/3), after 75 (3/3).
  • First table: before 17.7M-19.3M lines, after 65411 (one block).
  • On 26.9.9.28 (without Show the result in Pretty formats as soon as it arrives #117005) the new subtest reports "did not stop" (exit 124, 3/3): it still catches its bug.
  • 50/50 randomized runs, debug build; p50 5.34 s before, 3.46 s after.

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

Version info

  • Merged into: 26.10.1.2146-master (included in 26.10 and later)

…pipe`

The first subtest fails in `Fast test (arm_darwin)` with exit code 241
(MEMORY_LIMIT_EXCEEDED) or the 60 s timeout. `numbers(1e18)` never leaves
the 50 ms squash gap, so the first squashed table holds everything read
before the background thread first writes (17.7M-19.3M rows on Linux), and
`output_format_pretty_max_rows=1e12` renders all of it before the first
byte reaches `head`. Its size depends on host throughput; on the macOS
runner it is not rendered within the timeout or exceeds the memory limit.

Cap reading at 1M rows/s (`timeout_before_checking_execution_speed=0`
because the throttle is otherwise off for the first 10 s): the source then
sleeps longer than the squash window after each block, so every table is
one block (65411 lines). The subtest still writes every block into the
broken pipe and must exit with 75; on 26.9.9.28 (without ClickHouse#117005) it
reports "did not stop" (124).

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 10, 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; 0 findings) plus my own cold review of the diff (0 findings).

# Sev Finding Verdict Evidence / action
- - No findings - Checked: the throttle sleeps in ReadProgressCallback::onProgress, outside IOutputFormat::writing_mutex, so each 65409-row block leaves a gap longer than the 50 ms squash window; timeout_before_checking_execution_speed=0 is required (default 10 s); randomized settings do not reach clickhouse-local; without the error propagation from #117005 the throttled subtest exits 124 ("did not stop").

Severity: ❌ blocker / ⚠️ major / 💡 nit.

Session id: cron:clickhouse-review-slot-8:20261010-205900

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes, on Linux by emulating the late first write (10 s squash window, 4 GiB cap): the original subtest-1 command exits 241 in 1.2 s on every run (4/4). The macOS shape itself is shown only by this PR's Fast test (arm_darwin) run.
b Root cause explained? A continuous producer never leaves the 50 ms squash gap, so the first table holds everything read before the background thread first writes (throughput times time to first write, 17.7M-19.3M rows here), and output_format_pretty_max_rows=1e12 makes it render in full before the first byte reaches head. On the macOS runner that outlasts the 60 s timeout or the memory limit.
c Fix matches root cause? Yes: reading is capped at 1M rows/s, so the source sleeps longer than the squash window after each block and every table is one block (65411 lines measured, was 17.7M-19.3M). No widened bound, tag or shorter timeout.
d Test intent preserved / new tests added? Yes: every block is still written into the broken pipe and the subtest still has to exit 75. On 26.9.9.28 (without #117005) the new subtest reports "did not stop" (124, 3/3); the original one reports 241 there under a memory cap.
e Both directions demonstrated? Emulation: before 241 (4/4), after 75 (4/4). Defect sensitivity: 26.9.9.28 gives 124, master gives 75. 50/50 randomized runs pass (p50 5.34 s before, 3.46 s after).
f Fix is general across code paths? Test-only. The other subtests (DISTINCT, 100000 rows in total) and the other squash tests (05061, 03299) already produce bounded tables.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A for the product. The randomized settings do not reach the test's clickhouse-local, so the two new settings cannot be overridden.
h Backward compatible? (maintainer-approved exception only) Yes, no product or setting change.
i Invariants and contracts preserved? Yes: exit 75 on a broken pipe, 124 on a hang; .reference unchanged.

Session id: cron:clickhouse-impl-slot-4:20261010-202700

@clickhouse-gh

clickhouse-gh Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [b7c1574]

Summary: ✅


AI Review

Summary

This PR makes the first 05238_pretty_squash_broken_pipe subtest pace clickhouse-local with max_execution_speed so PrettyBlockOutputFormat flushes bounded tables instead of accumulating an oversized first write on fast machines. I checked the current diff against the background-error propagation path in PrettyBlockOutputFormat and did not find a correctness hole or a meaningful coverage regression in the updated test.

Final Verdict

Status: ✅ Approve

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 8c1b535

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) / 05339_parquet_prewhere_subcolumn_read_through_column not from this PR (it changes 05238 only): the test passes a session temporary table to IcebergLocal, which the replicated DDL worker cannot see (UNKNOWN_TABLE on iceberg_path). 12 PRs and 30 master runs show it since 2026-10-10 21:55Z #125121 (external, merged 00:36Z), the revert of my #124685 that added this test. The tested merge commit predates it, so I will merge master here to pick it up
Mergeable Check, PR praktika rollups of the row above #125121 (external, merged)
Sync - CH Inc sync (private, not actionable by me)

Session id: cron:our-pr-ci-monitor:20261011-013008

@clickhouse-gh clickhouse-gh Bot added comp-formats Input/output formats (CSV/JSON/Parquet/ORC/Arrow/Protobuf/etc.). and removed comp-testing Test content only (no production code). labels Nov 22, 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-formats Input/output formats (CSV/JSON/Parquet/ORC/Arrow/Protobuf/etc.). groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect 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.

3 participants