Repository navigation
Fix flaky 02357_query_cancellation_race - #119716
alexey-milovidov merged 1 commit into
Conversation
The test runs 100 iterations of an unbounded `insert into tab select number, toString(number) from system.numbers`, each stopped only by a 0.05s SIGINT. `|| true` swallows the exit code, so stderr is the test's only failure channel. The stateless CI profile puts a finite read limit on that unbounded read: tests/config/users.d/limits.yaml sets max_rows_to_read = 20000000 (and max_bytes_to_read = 1T) on profile `default`. An iteration that outlives its signal keeps reading; at block granularity ReadProgressCallback::onProgress calls SizeLimits::check and throws TOO_MANY_ROWS, which executeQuery logs at <Error>. Because $CLICKHOUSE_CLIENT always carries --send_logs_level=warning, that log line is streamed to the client and written to the test's stderr, and tests/clickhouse-test fails any test whose stderr is non-empty. Pin max_rows_to_read = 0, max_bytes_to_read = 0 on that insert so only the cancellation under test can end it. Both settings are consulted by the same SizeLimits::check call, so pinning one alone would establish half the invariant. This is the existing idiom for cancellation tests over an unbounded system.numbers read (04003_cancel_scalar_subquery.sh, 04051_cancel_parallel_with.sh, 04052_local_cancel_scalar_subquery.sh); 02357 was the only such test missing it. The oracle is not weakened: <Fatal> lines, crashes, logical errors and every other server exception still reach stderr and still fail the test. Co-Authored-By: Claude Opus 5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 1 finding), plus my own cold review of
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-9:20260913-010300 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20260912-232300 |
|
Workflow [PR], commit [d02cef1] Summary: ✅ AI ReviewSummaryThis PR narrows Final VerdictStatus: ✅ Approve |
393a7cc
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed flaky test
02357_query_cancellation_race, which could fail when the stateless CI read limit aborted its intentionally unbounded insert and the resulting error reached the test's stderr.Description
The test runs 100 iterations of an unbounded
insert into tab select number, toString(number) from system.numbers, each stopped by a 0.05sSIGINT.|| trueswallows the exit code, so stderr is the test's only failure channel.The stateless CI profile puts a finite read limit on that unbounded read:
tests/config/users.d/limits.yamlsetsmax_rows_to_read = 20000000. An iteration that outlives its signal keeps reading,ReadProgressCallback::onProgresscallsSizeLimits::check, andTOO_MANY_ROWSis logged at<Error>. Because$CLICKHOUSE_CLIENTalways carries--send_logs_level=warning, that line is streamed onto the test's stderr, andclickhouse-testfails any test whose stderr is non-empty. The test asserts nothing about read limits, so this is exposure, not a product defect.I pin
max_rows_to_read = 0, max_bytes_to_read = 0on that insert, so only the cancellation under test can end it. Both are checked by the sameSizeLimits::checkcall, so pinning one would establish half the invariant. This is the existing idiom for cancellation tests over an unboundedsystem.numbersread (04003_cancel_scalar_subquery.sh,04051_cancel_parallel_with.sh,04052_local_cancel_scalar_subquery.sh);02357was the only one missing it. The oracle is not weakened:<Fatal>lines, crashes, logical errors and every other server exception still reach stderr and still fail the test.Validation, at the profile's real
20000000with the window widened to 3s to force the race: 3/3 runs fail without this change (read_rows20015154,Code: 158), 0/3 with it.system.query_logthen recordsSettings['max_rows_to_read'] = 0and 87844287 rows read, 4.4x past the limit. Unmodified test, randomization on: 50/50 pass, p50 6.77s against 6.80s before.CI provenance, the first failure of this test in the retained window: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=119687&sha=5ad83a88e1eda5773c9e00c0a9c6ab7dbfe17f1a&name_0=PR
CIDB: every failure of this test in 90 days (query and result)
Against 207,700
OKrows over the same window. The two 2026-07-15 rows are a different class and arenot addressed here: both are
(total) memory limit exceeded ... current RSS 41.85 GiB, maximum 41.84 GiB,box-wide pressure that failed 90 and 62 tests respectively in those same two jobs. The 2026-09-12
failure is the one this fixes; it was 1 failure against 13,894
OKin its own job.Workflow [PR]
Sync PR [sync-upstream/pr/119716]