Skip to content

GH-1268: [JDBC] Honor DriverManager login timeout - #1507

Merged
jbonofre merged 1 commit into
apache:mainfrom
Ap-95671:fix/1268-jdbc-login-timeout
Nov 24, 2026
Merged

jbonofre merged 1 commit into
apache:mainfrom
Ap-95671:fix/1268-jdbc-login-timeout

Conversation

@Ap-95671

Copy link
Copy Markdown
Contributor

What's Changed

Honor the timeout configured through DriverManager.setLoginTimeout during Flight SQL JDBC connection establishment. The timeout covers the authentication handshake and initial session setup. Zero keeps the synchronous connection path without a login deadline.

When the deadline expires, return SQLTimeoutException and cancel pending login RPCs. Release partially constructed clients, channels, and allocators on failure, and close a connection if it finishes after the caller has timed out.

The JDBC login deadline and the Netty connectTimeoutMs socket setting are independent. DataSource login-timeout support is tracked separately in #1267.

Testing

  • Reproduced the stalled authentication on upstream. The driver's two-second login timeout did not fire, and the regression test reached its 15-second guard.
  • Covered stalled authentication and session setup, cancellation and transport closure, successful connections with zero and positive timeouts, and cleanup after the deadline. The driver and client-handler test classes passed all 32 cases.
  • Maven verification passed on JDK 21 with 4,607 passing test executions and 73 skips across 14 modules. Checkstyle, Spotless, dependency analysis, and the shaded JAR build passed.
  • A standalone DriverManager.getConnection smoke test using the shaded JAR raised SQLTimeoutException in 1,022 ms with a one-second timeout.

AI disclosure

Codex assisted with diagnosis, implementation, tests, validation, and drafting this description.

Closes #1268.

Bound Flight SQL login, cancel in-flight connection setup when the deadline expires, and close resources from failed or abandoned attempts.

Assisted-by: Codex
@jbonofre jbonofre added documentation PRs that improve documentation. enhancement PRs that add or improve features. labels Nov 24, 2026
@apache apache deleted a comment from github-actions Bot Nov 24, 2026
@github-actions github-actions Bot added this to the 20.1.0 milestone Nov 24, 2026

@jbonofre jbonofre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @Ap-95671!

The login timeout enforcement, gRPC context cancellation (without interrupting FlightClient.close()), abandoned-connection/channel/allocator cleanup, and ArrowFlightSqlClientHandler.close() fix all look solid. Keeping ArrowFlightJdbcDataSource decoupled (0 timeout) makes sense given #1267.

@jbonofre
jbonofre merged commit 758fb56 into apache:main Nov 24, 2026
22 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation PRs that improve documentation. enhancement PRs that add or improve features.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[JDBC] Honor DriverManager login timeout

2 participants