Skip to content

Revert "Revert "Mark a query as cancelled in the process list when its TCP client cancels it"" - #129311

Merged
alexey-milovidov merged 3 commits into
masterfrom
revert-129310-revert-127149-fix-04117-no-parallel-replicas
Nov 5, 2026
Merged

alexey-milovidov merged 3 commits into
masterfrom
revert-129310-revert-127149-fix-04117-no-parallel-replicas

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Reverts #129310


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

Version info

  • Merged into: 26.11.1.1432-master (included in 26.11 and later)

@clickhouse-gh

clickhouse-gh Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [5efa513]

Summary: ✅


AI Review

Summary

Restores process-list cancellation when a TCP client cancels or disconnects, so running pipeline work such as sleepEachRow stops before executor cleanup waits for it. Also reduces cancellation-related cleanup logging and runs the regression cases concurrently. Reviewed the full diff and current code at 5efa513b09e2df377efd24c241dc3793827c2a6a, including all prior discussion; no actionable findings. The added 05452_cancel_by_client_stops_sleep regression test passed in Fast test in 4.67 seconds.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Nov 4, 2026
@Algunenano

Copy link
Copy Markdown
Member

@groeneai Can you check what was broken in CI because of this?

We already fixed #129151, but I'm not sure if there were other tests affected. Please check tests that became flaky after the merge to see if we missed any others

@Algunenano Algunenano self-assigned this Nov 4, 2026
@Algunenano

Copy link
Copy Markdown
Member

Maybe also bring #129275 here?

@Algunenano

Copy link
Copy Markdown
Member

@groeneai I realize this in an internal PR. Please create a branch in your fork and commit there, then let me know when it's ready and I'll review it and pick the commits here

@groeneai

groeneai commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Acknowledged. I'm checking which tests started failing after the merge; I'll put the fixes (starting with #129275's commit) on a branch in my fork on top of this PR's head, and post the branch with the list of failures here when it's ready.

@clickhouse-gh clickhouse-gh Bot added the comp-protocols Server wire protocols + request/response handling (native TCP, HTTP, MySQL/PostgreSQL wire protoc... label Nov 4, 2026
@groeneai

groeneai commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

The branch is ready: https://github.com/groeneai/ClickHouse/commits/reland-127149-ci-fixes

It is master, then a re-land commit with the same tree as this PR's 7244105, then the commit to pick: 213a5d0 (#129275's fix, unchanged; it applies cleanly on 7244105). If you pick it here, I'll close #129275.

What #127149 broke between its merge (2026-11-03 22:39 UTC) and the revert (2026-11-04 15:40 UTC), from CIDB:

Test Jobs Failures after the merge Fix
test_read_temporary_tables_on_failure/test.py::test_different_versions Integration tests (amd_asan_ubsan, amd_msan, amd_tsan, arm_binary) 105 on master (report) plus 41 PRs; 0 in the 7 days before #129151 (no master failure after 12:49 UTC)
03312_squashing_with_low_card_mem_usage: having stderror, <Error> AsynchronousBoundedReadBuffer: Code: 735 ... (QUERY_WAS_CANCELLED_BY_CLIENT) Stateless tests (arm_binary, ParallelReplicas, s3 storage) 3 PRs (1, 2, 3); 0 with this error in the 30 days before 213a5d0
05452_cancel_by_client_stops_sleep: not failing, but 17.8 s p50 in Fast test Fast test - a speed-up is in progress; I'll add that commit to the same branch and say so here

Nothing else: no other failure after the merge mentions Code: 735, QUERY_WAS_CANCELLED_BY_CLIENT or a client Cancel packet, hung checks did not go up (2 in that window, 51 in the 7 days before), and the tests #127149 changed (04117, 04869, 05025, 05452) plus 02357_query_cancellation_race had 0 failures in that window. The other tests that first failed in it are single-PR or backport-branch failures unrelated to cancellation.

@clickhouse-gh

clickhouse-gh Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 5efa513b0 with master 96dc5c984 (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

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

Job report

@groeneai

groeneai commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

I added the 05452_cancel_by_client_stops_sleep speed-up to the same branch: groeneai/ClickHouse@a2e73c1. Its 8 cases now run four at a time, so the test takes about 5 s instead of 18 s in the Fast test configuration. It is test-only, the .reference is unchanged, and every case still fails without the fix.

So the commits to pick are 213a5d0 and a2e73c1 (not the re-land commit before them, which has the same tree as this PR's head).

groeneai and others added 2 commits November 4, 2026 18:19
…ynchronousBoundedReadBuffer

When a query reading object storage with prefetch is killed (or its TCP client cancels it), an
in-flight prefetch can fail with the query's own stored cancellation: a failed S3 GET attempt makes
`ReadBufferFromS3::processException` rethrow it via `CurrentThread::checkIfNotCancelled`. The future of
that prefetch is never consumed, so `~AsynchronousBoundedReadBuffer` drains it in `finalize` and logged
it at error level; with `send_logs_level` the line also reached the client, which failed
`03312_squashing_with_low_card_mem_usage` with `having stderror` in the ParallelReplicas s3 jobs, where
the initiator cancels its replicas once `LIMIT` is satisfied. Log it at debug level when the current
thread's query is cancelled, as `AsyncInsertQueueTransform` already does for the same case.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The test took ~18 s in Fast test because its 8 independent cases ran one
after another and each one is ~2.2 s of waiting: for its query to sleep for
over a second, then for it to stop at the end of the current 1 s sleep slice.
They now run four at a time (each case keeps a client running, and a sanitizer
client takes hundreds of MiB of the test's memory limit), each writing to its
own file, printed in the old order, and system.processes is polled over HTTP.
Queries, wait conditions, cancel actions and the reference are unchanged.

Fast test configuration, p50 of 10 runs: 18.4 s -> 4.9 s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 5, 2026
@alexey-milovidov alexey-milovidov self-assigned this Nov 5, 2026
Merged via the queue into master with commit 82d3761 Nov 5, 2026
185 checks passed
@alexey-milovidov
alexey-milovidov deleted the revert-129310-revert-127149-fix-04117-no-parallel-replicas branch November 5, 2026 17:16
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-protocols Server wire protocols + request/response handling (native TCP, HTTP, MySQL/PostgreSQL wire protoc... pr-not-for-changelog This PR should not be mentioned in the changelog 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.

4 participants