Repository navigation
Conversation
Signed-off-by: Youngbin Yu <contact@ybyu.dev>
yb-yu
force-pushed
the
fix/cancel-inflight-status-poll
branch
from
November 6, 2026 12:28
4236e1e to
6a162f4
Compare
This branch has not been deployed
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
Cancelling the caller context does not interrupt an in-flight Thrift status request because polling uses a detached context. The sentinel invokes that request synchronously, so remote cancellation cannot proceed until it returns. If the client exits first, the warehouse query can continue running until its statement timeout.
This patch uses the caller context for status polling while retaining the detached context for remote cancellation. It also lets the sentinel run its cancellation callback when a status request is interrupted.
Impact
This investigation started with a report that cancelling a dbt job left a warehouse query running until its two-hour statement timeout. I have not confirmed the exact cancellation path in that original run, but reproduced the polling failure described below in controlled tests.
Reproduction
I reproduced this with dbt Fusion on Databricks Serverless using dbt's v1.14.2 driver fork. Cancellation was triggered immediately after a status request started.
The runtime comparison used the dbt fork. On current upstream main, interrupting the status request alone is insufficient: the resulting error returns before the sentinel's cancellation callback runs. This patch also routes that case through the existing cancellation path.
Verification
Regression tests cover explicit cancellation and deadlines during a blocked status request. They verify that remote cancellation receives a live context, preserves context values and the operation handle, and occurs exactly once. The explicit-cancellation test fails on the unmodified upstream baseline and passes with this patch.
Passed locally:
CGO_ENABLED=0 go test ./... -count=1 -timeout=5mgo test -race ./internal/backend/thrift -count=1 -timeout=2mmake lint— 0 issuesCGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ./...