-
Notifications
You must be signed in to change notification settings - Fork 96
GH-863: [JDBC] Suppress benign exceptions from gRPC layer on ArrowFlightSqlClientHandler#close #910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
…on error suppression Add unit and integration tests for the error suppression functionality in ArrowFlightSqlClientHandler: - ArrowFlightSqlClientHandlerTest: 18 unit tests covering error detection, logging, and exception handling logic using Mockito and reflection - ArrowFlightSqlClientHandlerIntegrationTest: 4 integration tests with real FlightServer to validate error suppression in realistic scenarios Tests verify that benign gRPC shutdown errors (UNAVAILABLE and INTERNAL with GOAWAY) are properly suppressed while genuine failures are correctly propagated as exceptions.
…reliability This commit addresses bugs introduced in the error suppression implementation: 1. Fixed NullPointerException in isBenignCloseException() when FlightRuntimeException.getMessage() returns null. Added null check before calling contains() on the message string. 2. Fixed unit test setup to avoid attempting real server connections during test initialization. Tests now use reflection to test private methods without requiring actual network connections. 3. Fixed Mockito unnecessary stubbing warnings by making all mock objects lenient, allowing tests to create comprehensive mocks without triggering warnings when not all stubbings are used. 4. Simplified integration tests to focus on testable scenarios. Removed tests that required mocking gRPC service methods (closeSession) which are not routed through FlightProducer, making them difficult to test in isolation. Test Results: - 21 tests total (15 unit + 1 integration + 5 builder tests) - All tests passing with 0 failures and 0 errors - Comprehensive coverage of error suppression logic via reflection-based unit tests
|
Thank you for opening a pull request! Please label the PR with one or more of:
Also, add the 'breaking-change' label if appropriate. See CONTRIBUTING.md for details. |
|
This PR is based on https://github.com/apache/arrow-java/pull/864/files, @vandop asked me to take it over from him. I simplified the tests. I don't think this merits a full integration test with shutting down a server because all the logic is inside a single method. About the logging level: for the original issue at https://github.com/apache/arrow/pull/14210/files the log level was set to warn, and in Vando's PR @lidavidm asked for the log level to be debug. It's not clear to me the reason for the discrepancy, and I put it as info. |
What's Changed
When using the Flight SQL JDBC driver with connection pooling and a catalog parameter, ArrowFlightSqlClientHandler.close() performs a CloseSession RPC that can fail during gRPC channel shutdown.
These transient failures (UNAVAILABLE or INTERNAL with "Connection closed after GOAWAY") cause noisy errors in pooling frameworks like Apache Commons DBCP.
With this PR these exceptions will instead be suppressed and logged, following the procedure that was used for ARROW-17785
Are these changes tested?
Yes
Closes #863