Skip to content

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

Open
Ap-95671 wants to merge 1 commit into
apache:mainfrom
Ap-95671:fix/1268-jdbc-login-timeout
Open

Ap-95671 wants to merge 1 commit into
apache:mainfrom
Ap-95671:fix/1268-jdbc-login-timeout

Conversation

@Ap-95671

Copy link
Copy Markdown

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
@github-actions

Copy link
Copy Markdown

Thank you for opening a pull request!

Please label the PR with one or more of:

  • bug-fix
  • chore
  • dependencies
  • documentation
  • enhancement

Also, add the 'breaking-change' label if appropriate.

See CONTRIBUTING.md for details.

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.

[JDBC] Honor DriverManager login timeout

1 participant