Skip to content

Conversation

@vandop
Copy link

@vandop vandop commented Sep 23, 2025

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.

…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.
@vandop vandop closed this Sep 23, 2025
@vandop vandop deleted the fix/close-session-suppress-catalog branch September 23, 2025 16:58
@vandop
Copy link
Author

vandop commented Sep 23, 2025

sorry, messed up trying to open on my local fork...

@vandop vandop restored the fix/close-session-suppress-catalog branch September 24, 2025 13:58
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.

1 participant