Skip to content

SNOW-3479780: unblock canceled chunk downloader reads#1796

Merged
sfc-gh-boler merged 1 commit into
masterfrom
boler/SNOW-3479780-gosnowflake-chunk-downloader-cancel
May 13, 2026
Merged

SNOW-3479780: unblock canceled chunk downloader reads#1796
sfc-gh-boler merged 1 commit into
masterfrom
boler/SNOW-3479780-gosnowflake-chunk-downloader-cancel

Conversation

@sfc-gh-boler
Copy link
Copy Markdown
Collaborator

@sfc-gh-boler sfc-gh-boler commented May 12, 2026

SNOW-3479780 extends the issue #1789 cancellation fix to the chunk_downloader.go path used by database/sql. Once a chunk response has been opened, the downloader can block inside JSON or Arrow decode waiting on the live HTTP body, which also leaves Rows.Next() stuck until the client timeout because the waiting row reader does not see an error until the download goroutine returns.

This change wraps the downloader response body in the same cancel-aware stream used by the Arrow stream loader so ctx.Done() actively closes the underlying body, unblocks the stalled read, and normalizes the resulting terminal transport error to ctx.Err(). Focused tests cover both the decode helper and the next() waiting path so canceled database/sql reads now unblock promptly without switching away from the default streaming model or pulling Reset/retry handling into scope.

Checklist

  • Added proper logging (if possible)
  • Created tests which fail without the change (if possible)
  • Extended the README / documentation, if necessary

@sfc-gh-boler sfc-gh-boler requested a review from a team as a code owner May 12, 2026 17:14
@sfc-gh-boler sfc-gh-boler force-pushed the boler/SNOW-3479780-gosnowflake-arrow-stream-cancel branch 2 times, most recently from 1cf5b23 to ec641ae Compare May 13, 2026 13:51
Base automatically changed from boler/SNOW-3479780-gosnowflake-arrow-stream-cancel to master May 13, 2026 15:00
SNOW-3479780 extends the issue #1789 cancellation fix to the
`chunk_downloader.go` path used by `database/sql`. Once a chunk
response has been opened, the downloader can block inside JSON or
Arrow decode waiting on the live HTTP body, which also leaves
`Rows.Next()` stuck until the client timeout because the waiting row
reader does not see an error until the download goroutine returns.

This change wraps the downloader response body in the same
cancel-aware stream used by the Arrow stream loader so `ctx.Done()`
actively closes the underlying body, unblocks the stalled read, and
normalizes the resulting terminal transport error to `ctx.Err()`.
Focused tests cover both the decode helper and the `next()` waiting
path so canceled `database/sql` reads now unblock promptly without
switching away from the default streaming model or pulling Reset/retry
handling into scope.
@sfc-gh-boler sfc-gh-boler force-pushed the boler/SNOW-3479780-gosnowflake-chunk-downloader-cancel branch from f23488d to c348b73 Compare May 13, 2026 15:34
@sfc-gh-boler sfc-gh-boler enabled auto-merge (squash) May 13, 2026 16:08
@sfc-gh-boler sfc-gh-boler merged commit 59c5c8f into master May 13, 2026
55 of 56 checks passed
@sfc-gh-boler sfc-gh-boler deleted the boler/SNOW-3479780-gosnowflake-chunk-downloader-cancel branch May 13, 2026 16:18
@github-actions github-actions Bot locked and limited conversation to collaborators May 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants