Fix server abort on cancelled INSERT into TimeSeries table#108796
Merged
tiandiwonder merged 1 commit intoJun 30, 2026
Conversation
AliasSink and TimeSeriesSink share the same shape: a SinkToStorage that owns a started PushingPipelineExecutor and finalizes it only in onFinish. When the outer pipeline is cancelled without an exception (for example with timeout_overflow_mode = 'break', an early LIMIT, or sibling-processor teardown), the graph is cancelled via PipelineExecutor::cancel -> graph->cancel, and IProcessor::cancel only invokes the default no-op onCancel. So neither onFinish nor onException runs. TimeSeriesSink had no onException/onCancel override and TargetPipeline's destructor was defaulted, so it destroyed a started-but-unfinished executor with no in-flight exception, tripping ~PushingPipelineExecutor's invariant 'finished || std::uncaught_exceptions() || std::current_exception()' and aborting the server in debug and sanitizer builds. Give TargetPipeline a destructor that cancels the executor, mirroring AliasSink (PR #108783), CreatingSetsTransform, and MaterializingCTETransform. PushingPipelineExecutor::cancel sets finished = true, so the invariant holds; on the normal path onFinish already finished the executor, so cancel is a no-op. This is the same cancellation-without-exception class as issue #57097. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
Workflow [PR], commit [98a0f03] Summary: ✅
AI ReviewSummaryThis PR fixes cancellation teardown for Missing context / blind spots
Final VerdictStatus: ✅ Approve No code-review changes required. |
Contributor
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 5/6 (83.33%) | Lost baseline coverage: none · Uncovered code |
scanhex12
approved these changes
Jun 29, 2026
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.
Related: #108783
Related: #57097
Problem
Inserting into a
TimeSeriestable runs nested INSERT pipelines insideTimeSeriesSink. When the outer query is cancelled without an exception — for example withtimeout_overflow_mode = 'break', an earlyLIMIT, or sibling-processor teardown — the server aborts in debug and sanitizer builds:This is the same cancellation-without-exception class as
AliasSink(fixed in #108783) and issue #57097, found while explaining that PR.Root cause
TimeSeriesSinkowns up to threeTargetPipelinestructs, each holding aPushingPipelineExecutorcreated and immediately started increateTargetPipeline. The sink finalized those executors only inonFinish(executor->finish()); it did not overrideonExceptionoronCancel, and~TargetPipelinewas= default. On a no-exception cancel, the graph is cancelled viaPipelineExecutor::cancel(CancelledByTimeout)→graph->cancel, andIProcessor::cancelonly invokes the default no-oponCancel, so neitheronFinishnoronExceptionruns. The defaulted destructor then destroyed a started-but-unfinished executor with no in-flight exception, tripping~PushingPipelineExecutor'sfinished || std::uncaught_exceptions() || std::current_exception()invariant. The exception path was already safe becausestd::uncaught_exceptions()holds during unwinding; only the no-exception cancel path was broken.Fix
Give
TargetPipelinea destructor that cancels the executor, mirroringAliasSink::~AliasSink(#108783),CreatingSetsTransform, andMaterializingCTETransform.PushingPipelineExecutor::cancelsetsfinished = true, satisfying the destructor invariant; on the normal pathonFinishalready finished the executor, so the destructor'scancelis a no-op. Regression test04416_timeseries_insert_cancel_no_crashexercises thetimeout_overflow_mode = 'break'path and asserts the server survives; it reproduces the abort on the unfixed binary and passes after the fix (verified locally in a debug build).Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed a server abort (
LOGICAL_ERROR/ assertion in debug and sanitizer builds) when anINSERT ... SELECTinto aTimeSeriestable is cancelled without an exception, for example withtimeout_overflow_mode = 'break'.Documentation entry for user-facing changes
Version info
26.7.1.277(included in26.7and later)