Skip to content

Do not allow to cancel other running statements#245

Merged
staticlibs merged 1 commit intoduckdb:mainfrom
staticlibs:cancel_statement_check
Jun 5, 2025
Merged

Do not allow to cancel other running statements#245
staticlibs merged 1 commit intoduckdb:mainfrom
staticlibs:cancel_statement_check

Conversation

@staticlibs
Copy link
Collaborator

Statement#cancel() call works on connection level. So currently it is well possible to run query in one statement, and then interrupt this query calling cancel on another statement.

This change adds a check that cancellation can only be performed if the query on current statement is still running. Otherwise stmt.cancel() call is a no-op.

Testing: new test added that checks that other statement cannot be cancelled.

`Statement#cancel()` call works on connection level. So currently it is
well possible to run query in one statement, and then interrupt this
query calling cancel on another statement.

This change adds a check that cancellation can only be performed if
the query on current statement is still running. Otherwise
`stmt.cancel()` call is a no-op.

Testing: new test added that checks that other statement cannot be
cancelled.
@staticlibs staticlibs force-pushed the cancel_statement_check branch from 9e25c62 to 44264d0 Compare June 5, 2025 18:37
@staticlibs staticlibs merged commit 5f877ad into duckdb:main Jun 5, 2025
19 of 20 checks passed
@staticlibs staticlibs deleted the cancel_statement_check branch June 5, 2025 19:52
staticlibs added a commit to staticlibs/duckdb-java that referenced this pull request Jun 15, 2025
This is a backport of the PR duckdb#245 to `v1.3-ossivalis` stable branch.

`Statement#cancel()` call works on connection level. So currently it is
well possible to run query in one statement, and then interrupt this
query calling cancel on another statement.

This change adds a check that cancellation can only be performed if
the query on current statement is still running. Otherwise
`stmt.cancel()` call is a no-op.

Testing: new test added that checks that other statement cannot be
cancelled.
staticlibs added a commit that referenced this pull request Jun 15, 2025
This is a backport of the PR #245 to `v1.3-ossivalis` stable branch.

`Statement#cancel()` call works on connection level. So currently it is
well possible to run query in one statement, and then interrupt this
query calling cancel on another statement.

This change adds a check that cancellation can only be performed if
the query on current statement is still running. Otherwise
`stmt.cancel()` call is a no-op.

Testing: new test added that checks that other statement cannot be
cancelled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant