Skip to content
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

Use connect timeout while establishing (socket) connection [JDBC279] #325

Closed
firebird-issue-importer opened this issue Oct 29, 2012 · 10 comments
Closed

Comments

@firebird-issue-importer

Submitted by: @mrotteveel

Is related to JDBC238
Jira_subtask_outward JDBC295

Votes: 1

The Jaybird wire protocol currently doesn't use a connect timeout, this means that in some cases a connection will actually fail after a considerably long time (depends on the socket connect timeout of the underlying OS and other factors; theoretically it could be indefinitely).

Change Jaybird to use unconnected sockets and use the connect method that uses a timeout. Consider if this needs to be a connection property, or if the DriverManager.getLoginTimeout() should be used (see http://docs.oracle.com/javase/7/docs/api/java/sql/DriverManager.html#getLoginTimeout() ) or a combination of these options.

Also check if (and how) this could be applied to the native driver.

Commits: e9d32c0 5fe0bea

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 29, 2012

Modified by: @mrotteveel

Link: This issue is related to JDBC238 [ JDBC238 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 29, 2012

Commented by: @mrotteveel

Scheduled for 2.3, if easy/small also backport to 2.2.2

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 29, 2012

Modified by: @mrotteveel

Fix Version: Jaybird 2.3 [ 10440 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Nov 19, 2012

Commented by: hugo Larsson (hugol)

It would be fantastic if this feature could be implemented in version 2.2.2

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Dec 1, 2012

Commented by: @mrotteveel

Firebird has the dpb item isc_dpb_connect_timeout which is the connect timeout in seconds. I will add support in Jaybird for this dpb item, which will fallback to the loginTimeout specified in DriverManager. If no timeout is specified (and DriverManager.getLoginTimeout() returns 0), then the timeout will be OS dependent (for example: about 20 seconds on Windows 8).

This also means the timeout cannot have a subsecond value. I could add a millisecond variant, but that would only work for the pure java driver and not for the JNI driver.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Dec 2, 2012

Commented by: @mrotteveel

Got it working for pure java, but the native library seems to ignore the isc_dpb_connect_timeout item.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Dec 2, 2012

Commented by: @mrotteveel

Committed implementation to trunk, it however won't work with native (where isc_dpb_connect_timeout seems to be a timeout for executing op_accept after establishing the socket connection). Will need to look into this further, also if I need to use the connectTimeout in the pure-java implementation as the SoTimeout during the op_accept fase.

Potential workaround for the lack of a socket connect timeout with native would be to construct an InetAddress and call isReachable with the timeout, but I am not sure if that is a good idea, because establishing a connection on a slow link might take even longer.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Dec 31, 2012

Commented by: @mrotteveel

Added subtask to backport to 2.2.2

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 24, 2015

Modified by: @mrotteveel

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 7, 2017

Modified by: @mrotteveel

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment