Repository navigation
fix(client): detect dead connections with gRPC keepalive - #23
Merged
Merged
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
redox
approved these changes
Oct 16, 2026
…test Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
utay
pushed a commit
that referenced
this pull request
Oct 16, 2026
🤖 I have created a release *beep* *boop* --- ## [0.4.1](v0.4.0...v0.4.1) (2026-10-16) ### Bug Fixes * **client:** detect dead connections with gRPC keepalive ([#23](#23)) ([3247b66](3247b66)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
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
FlightUnavailableErrorinstead of a hang.If a connection is cut while the client waits for a statement result, only the server notices. The client has nothing to send, so its TCP stack never retransmits and the call hangs forever. Callers such as dbt-altertable get the fix without any change on their side.
Channel options added to
FlightClient:grpc.keepalive_time_ms=30000andgrpc.keepalive_timeout_ms=20000.grpc.http2.ping_timeout_ms=20000: the gRPC bundled with recent pyarrow releases times keepalive pings out with this option (default 60s), notkeepalive_timeout_ms.grpc.http2.max_pings_without_data=0: by default gRPC stops pinging after two pings while the client sends no data, which is exactly the long-statement case.grpc.keepalive_permit_without_calls=1: also detect dead idle connections between statements.The server's tonic/h2 stack does not reject frequent client pings, so a 30s interval is safe.
Testing
tests/test_keepalive.pyruns a minimal grpcio Flight server behind a TCP proxy. It uses grpcio rather than pyarrow's server because older pyarrow servers (21, used on Python 3.9) reject frequent pings withtoo_many_pings, unlike the production tonic server. It keeps the connection healthy for 5s while a statement blocks, then silently stops forwarding bytes and asserts the call fails within 15s. The test fails if eitherping_timeout_msormax_pings_without_datais removed.Made with Cursor