JDBC Flight SQL: Suppress benign CloseSession errors in handler.close() when catalog is set #856
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.