Skip to content

SNOW-3479780: unblock canceled Arrow chunk reads#1795

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

SNOW-3479780: unblock canceled Arrow chunk reads#1795
sfc-gh-boler merged 1 commit into
masterfrom
boler/SNOW-3479780-gosnowflake-arrow-stream-cancel

Conversation

@sfc-gh-boler
Copy link
Copy Markdown
Collaborator

SNOW-3479780 / issue #1789 report that canceling an Arrow stream after the chunk response is already open can leave the read path stalled until the client timeout because nothing interrupts the live body read. In practice that also leaves the caller-facing read goroutine stuck and surfaces transport-specific close behavior instead of a clean context.Canceled.

This change wraps opened Arrow chunk streams in a cancel-aware reader that interrupts the raw response body when ctx.Done() fires, normalizes interrupted terminal read errors to ctx.Err(), and still preserves true successful completion and EOF semantics, including the final n > 0, io.EOF case. The tests now cover stalled-read unblock, non-EOF close-error normalization, already-canceled GetStream() behavior, close-then-cancel watcher shutdown, and completed plain and gzip-backed streams. The default streaming model is unchanged, and Reset/retry integration stays out of 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 12:54
@sfc-gh-boler sfc-gh-boler force-pushed the boler/SNOW-3479780-gosnowflake-arrow-stream-cancel branch from 823c86a to 170585a Compare May 12, 2026 17:13
Comment thread arrow_stream.go Outdated
Copy link
Copy Markdown
Collaborator

@sfc-gh-dheyman sfc-gh-dheyman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one comment, but overall LGTM

@sfc-gh-boler sfc-gh-boler force-pushed the boler/SNOW-3479780-gosnowflake-arrow-stream-cancel branch from 170585a to 1cf5b23 Compare May 13, 2026 13:20
SNOW-3479780 / issue #1789 report that canceling an Arrow stream
after the chunk response is already open can leave the read path
stalled until the client timeout because nothing interrupts the live
body read. In practice that also leaves the caller-facing read
goroutine stuck and surfaces transport-specific close behavior instead
of a clean `context.Canceled`.

This change wraps opened Arrow chunk streams in a cancel-aware reader
that interrupts the raw response body when `ctx.Done()` fires,
normalizes interrupted terminal read errors to `ctx.Err()`, and still
preserves true successful completion and EOF semantics, including the
final `n > 0, io.EOF` case. The tests now cover stalled-read unblock,
non-EOF close-error normalization, already-canceled `GetStream()`
behavior, close-then-cancel watcher shutdown, and completed plain and
gzip-backed streams. The default streaming model is unchanged, and
Reset/retry integration stays out of scope.
@sfc-gh-boler sfc-gh-boler force-pushed the boler/SNOW-3479780-gosnowflake-arrow-stream-cancel branch from 1cf5b23 to ec641ae Compare May 13, 2026 13:51
@sfc-gh-boler sfc-gh-boler enabled auto-merge (squash) May 13, 2026 13:52
@sfc-gh-boler sfc-gh-boler merged commit 678f765 into master May 13, 2026
55 of 56 checks passed
@sfc-gh-boler sfc-gh-boler deleted the boler/SNOW-3479780-gosnowflake-arrow-stream-cancel branch May 13, 2026 15:00
@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