JDBC Flight SQL: Suppress benign CloseSession errors in handler.close() when catalog is set#856
Closed
vandop wants to merge 1 commit into
Closed
JDBC Flight SQL: Suppress benign CloseSession errors in handler.close() when catalog is set#856vandop wants to merge 1 commit into
vandop wants to merge 1 commit into
Conversation
…hen catalog is set This change addresses race conditions during gRPC channel shutdown that occur when using connection pooling with catalog parameters. The CloseSession RPC can fail with UNAVAILABLE or 'Connection closed after GOAWAY' errors during normal connection cleanup. Key improvements: - Refactored duplicate exception handling code into reusable helper methods - Added comprehensive error suppression for both AutoCloseable cleanup and CloseSession - Follows the established ARROW-17785 pattern from PreparedStatement.close() - Improved logging with context-aware debug/info messages - Fixed typo in existing error suppression logging The refactoring eliminates code duplication while maintaining identical functionality and improving maintainability.
Author
|
sorry, messed up trying to open on my local fork... |
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
This PR fixes a shutdown-noise issue in the Java Flight SQL JDBC driver when a catalog is set. In that case, ArrowFlightSqlClientHandler.close() performs a CloseSession RPC that can fail if the gRPC channel is already shutting down. Pooling layers (e.g., Apache Commons DBCP used by JMeter) treat that exception as a hard error even though the session is closing. The fix mirrors PreparedStatement.close() (ARROW-17785) by suppressing only transient shutdown errors and surfacing real failures.
Problem Statement
• Affected component: flight/flight-sql-jdbc-core – ArrowFlightSqlClientHandler.close()
• Trigger condition: JDBC connection created with a catalog (session option). On close(), the driver calls FlightSqlClient.closeSession().
• Failure mode: During pool/connection teardown, the gRPC channel may be closing already, causing FlightRuntimeException with:
Why fix in ArrowFlightSqlClientHandler.close()
• ArrowFlightConnection.close() delegates to clientHandler.close(), and some paths also close the handler via AutoCloseables. Fixing at the handler ensures both code paths are safe.
• This mirrors the precedent already in PreparedStatement.close() (ARROW-17785) where transient gRPC shutdown errors are suppressed.