Repository navigation
Revert "Make Ctrl+C terminate the output of a result set in the client promptly" - #107845
Merged
Merged
Conversation
Contributor
|
Workflow [PR], commit [3498571] Summary: ❌
AI ReviewSummaryThis PR reverts Missing context / blind spots
Final VerdictStatus: ✅ Approve |
Contributor
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 21/22 (95.45%) | Lost baseline coverage: none · Uncovered code |
Algunenano
enabled auto-merge
June 19, 2026 13:01
1 task
alexey-milovidov
added a commit
that referenced
this pull request
Jun 30, 2026
Addresses the AI review finding on #108078: `ClientBase::resetOutput` calls `output_format->finalize()` before the output cancellation hooks installed on `std_out`, the pager stdin and the `INTO OUTFILE ... AND STDOUT` stdout buffer can be safely re-pointed. That re-pointing has to wait until the parallel-formatting collector that also reads the hook is joined - re-pointing the `std::function` while that thread reads it is exactly the data race that reverted the feature in #107845 - so it runs only after `output_format.reset()`. On an exception path the interrupt handler is already stopped by then, and the live hook returned `query_interrupt_handler.cancelled()`, which is unconditionally true once the handler is stopped. So that `finalize()` flush discarded the already-produced output even though the query was never cancelled, truncating it on paths such as a `NetException` after some result blocks but before `EndOfStream`. Make the live hook lifetime-safe instead of re-pointing it: add `QueryInterruptHandler::isRunning` (armed between `start` and `stop`) and gate the hook on `isRunning() && cancelled()`. While the query runs the handler is armed, so prompt Ctrl+C cancellation is unchanged; once it is stopped during teardown the hook reports no cancellation, so the `finalize()` flush preserves the output. The hook only reads atomics, so it does not reintroduce the collector data race that re-pointing the `std::function` would.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reverts #106430
https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=73e97deb9abbc3258e75d297aabfc3fbe7c3ca5e&name_0=MasterCI&name_1=BuzzHouse%20%28amd_tsan%29&name_1=BuzzHouse%20%28amd_tsan%29
Version info
26.6.1.1036