Repository navigation
fix(drivers): a Stop that lands while a DuckDB, MongoDB, Cassandra, DynamoDB or Snowflake statement waits keeps it from running - #4761
Merged
Conversation
… keeps it off the server
…ynamoDB or Snowflake statement waits keeps it from running
datlechin
force-pushed
the
fix/registry-drivers-stop-before-start
branch
from
November 30, 2026 06:06
a439a4b to
a19d490
Compare
datlechin
changed the base branch from
fix/mysql-stop-before-register
to
main
November 30, 2026 06:08
…stop-before-start # Conflicts: # apple/Plugins/Shared/PluginStatementTickets.swift
Member
Author
|
Correction to the review line: the shielded ROLLBACK a late |
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.
Summary
duckdb_interruptreaches only a running query and DuckDB clears it when the next one starts, so a Stop during the wait was lost.execute(query:)takes no check: host cleanup after a Stop goes through it.PluginStatementTickets) and the engine queue admits it right afterbeginStatement. That call clears the latch a Stop sets, so a Stop that landed while the statement waited for the engine was wiped and the statement ran, writes included.cancelQuery()now runs the runtime's cancel under the ticket stop.execute(query:)takes no ticket, and neither does a user'sSELECT 1, which a ping answers.executeParameterized(alsoexecuteUserQuerywith parameters) begins its cancellation before the wait for the connection actor and passes it down, asexecutealready did.executeUserQuery,executeParameterized, the streamed capped read) checks for Stop before every send, the re-send after a session renewal included. A Stop during a renewal aborted a request the server had already refused, and the renewal then sent it again. A Stop marks the requests it can mean, and a marked request is never sent again. The host's cleanup sent from the task the Stop cancelled, such as its ROLLBACK, is not marked and a latecancelQuery()no longer aborts it. A ROLLBACK the host shields from cancellation can still be aborted by a latecancelQuery(), as on main; the kit 48 PR closes that.PluginStatementTickets.swiftfor the MongoDB driver; its nested types are markednonisolated.data(for:)still sends, which a shared cancel-before-resume helper would close.Test plan
MongoScriptStopTests(new, iOS): a statement whose ticket a Stop covered never runs on the engine, and one that takes its ticket after the Stop runs.DuckDBStopBeforeStatementTests(new, iOS, in-memory DuckDB): a user statement and a parameterized one from a cancelled task change nothing;execute(query:)still runs.MongoScriptHostPolicyTestspasses the newadmitargument..claude/rules/tests.md); AllPlugins compiles them.verify.sh ioson the branch that stacks this PR with the other Stop PRs:MongoScriptStopTests,DuckDBStopBeforeStatementTests,MongoScriptHostPolicyTests,CloudflareD1OnIOSTests,DataBrowserViewModelTests, 95 of 95.verify.sh plugins(AllPlugins compiles every registry driver): PASS;verify.sh ios MongoScriptStopTests DuckDBStopBeforeStatementTests MongoScriptHostPolicyTests: 14 of 14.verify.sh linton each changed Swift file: PASS.SELECT 1taking a ticket it never spent; a latecancelQuery()aborting cleanup sent after the Stop. The last round's remaining finding, a ROLLBACK the host shields from the Stop, closes with the kit 48 PR, where Snowflake aborts only the statements the host marks.Uses the shared ticket type from #4758.