Skip to content

fix(flight/flightsql): recover real error when prepared DoPut stream closes early#920

Merged
zeroshade merged 1 commit into
apache:mainfrom
fornwall:fix/prepared-doput-eof
Jul 10, 2026
Merged

fix(flight/flightsql): recover real error when prepared DoPut stream closes early#920
zeroshade merged 1 commit into
apache:mainfrom
fornwall:fix/prepared-doput-eof

Conversation

@fornwall

Copy link
Copy Markdown
Contributor

DISCLAIMERS:

When a prepared statement's bound-parameter DoPut stream is torn down by the server before the client finishes sending (e.g. the server handler returns without draining the request stream), gRPC surfaces the parameter send as a bare io.EOF.

Per gRPC's contract an io.EOF from a send only means "the stream ended -- receive to learn why", but bindParameters and ExecuteUpdate forwarded that EOF directly, so the caller saw an uninformative "EOF (Unknown)" instead of the server's actual status.

Treat a send-side io.EOF as a signal to fall through to the receive, which recovers the real error (or the response the server produced before closing).

Adds a regression test whose server returns InvalidArgument without reading the stream; a large binding forces the send to block on flow control and observe the teardown, so the test fails deterministically without the fix.

…closes early

When a prepared statement's bound-parameter DoPut stream is torn down by the
server before the client finishes sending (e.g. the server handler returns
without draining the request stream), gRPC surfaces the parameter send as a
bare io.EOF. Per gRPC's contract an io.EOF from a send only means "the stream
ended -- receive to learn why", but bindParameters and ExecuteUpdate forwarded
that EOF directly, so the caller saw an uninformative "EOF (Unknown)" instead
of the server's actual status.

Treat a send-side io.EOF as a signal to fall through to the receive, which
recovers the real error (or the response the server produced before closing).

Adds a regression test whose server returns InvalidArgument without reading the
stream; a large binding forces the send to block on flow control and observe
the teardown, so the test fails deterministically without the fix.

Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>
@zeroshade zeroshade merged commit da6ec02 into apache:main Jul 10, 2026
25 of 26 checks passed
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.

2 participants