Skip to content

jdbc: connection may appear hang in case of connection issues #38

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

Closed
ztarvos opened this issue Sep 5, 2018 · 1 comment
Closed

jdbc: connection may appear hang in case of connection issues #38

ztarvos opened this issue Sep 5, 2018 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ztarvos
Copy link

ztarvos commented Sep 5, 2018

I tried to use jdbc and the firewall was preventing the connection. The application seemed to hang.
Although, as I found out later, it actually was the effect of some OS-defined timeout,
it would be good to set meaningful timeout in the jdbc driver, especially when default socket provider is used.

Also, the exception thrown is not SQLException that one would expect from the jdbc driver.

Exception in thread "main" org.tarantool.CommunicationException: Couldn't connect to tarantool at org.tarantool.TarantoolBase.<init>(TarantoolBase.java:76) at org.tarantool.TarantoolConnection.<init>(TarantoolConnection.java:18) at org.tarantool.jdbc.SQLDriver$1.<init>(SQLDriver.java:51) at org.tarantool.jdbc.SQLDriver.connect(SQLDriver.java:51) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:270) at TestJdbc.main(TestJdbc.java:10) Caused by: java.io.EOFException at java.io.DataInputStream.readFully(DataInputStream.java:197) at java.io.DataInputStream.readFully(DataInputStream.java:169) at org.tarantool.TarantoolBase.<init>(TarantoolBase.java:45) ... 6 more

I propose:

  • to set the timeout for default socket provider.
  • make exception compliant to specification.
  • implement control over timeouts in the driver as per specification (i.e. Connection.setNetworkTimeout, Statement.setQueryTimeout) or at least provide a connection property for that purposes.
@kyukhin kyukhin added the bug Something isn't working label Sep 20, 2018
ztarvos added a commit to ztarvos/tarantool-java that referenced this issue Oct 8, 2018
Added connection property 'socketTimeout' to allow user control over
network timeout before actual connection is returned by the driver.

Implemented 'Connection.setNetworkTimeout' API to make it possible to
change the maximum amount of time to wait for server replies after the
connection is established.

Fixed non-conforming methods to throw SQLException as per standard.

Closes tarantool#38
ztarvos added a commit to ztarvos/tarantool-java that referenced this issue Oct 12, 2018
Added connection property `socketTimeout` to allow user control over
network timeout before actual connection is returned by the driver.
This is only done for default socket provider. The default timeout is
is left to be infinite.

Implemented `Connection.setNetworkTimeout` API to make it possible to
change the maximum amount of time to wait for server replies after the
connection is established.

The connection that has timed out is forced to close. New subsequent
operations requested on such connection must fail right away.
The corresponding checks are embedded into relevant APIs.

Closes tarantool#38
@Totktonada Totktonada added this to the JDBC MVP milestone Nov 1, 2018
ztarvos added a commit to ztarvos/tarantool-java that referenced this issue Nov 15, 2018
Added connection property `socketTimeout` to allow user control over
network timeout before actual connection is returned by the driver.
This is only done for default socket provider. The default timeout is
left to be infinite.

Implemented `Connection.setNetworkTimeout` API to make it possible to
change the maximum amount of time to wait for server replies after the
connection is established.

The connection that has timed out is forced to close. New subsequent
operations requested on such connection must fail right away.
The corresponding checks are embedded into relevant APIs.

Closes tarantool#38
ztarvos added a commit to ztarvos/tarantool-java that referenced this issue Dec 3, 2018
Added connection property `socketTimeout` to allow user control over
network timeout before actual connection is returned by the driver.
This is only done for default socket provider. The default timeout is
left to be infinite.

Implemented `Connection.setNetworkTimeout` API to make it possible to
change the maximum amount of time to wait for server replies after the
connection is established.

The connection that has timed out is forced to close. New subsequent
operations requested on such connection must fail right away.
The corresponding checks are embedded into relevant APIs.

Closes tarantool#38
ztarvos added a commit to ztarvos/tarantool-java that referenced this issue Dec 5, 2018
Added connection property `socketTimeout` to allow user control over
network timeout before actual connection is returned by the driver.
This is only done for default socket provider. The default timeout is
left to be infinite.

Implemented `Connection.setNetworkTimeout` API to make it possible to
change the maximum amount of time to wait for server replies after the
connection is established.

The connection that has timed out is forced to close. New subsequent
operations requested on such connection must fail right away.
The corresponding checks are embedded into relevant APIs.

Closes tarantool#38
Totktonada pushed a commit that referenced this issue Dec 10, 2018
Added connection property `socketTimeout` to allow user control over
network timeout before actual connection is returned by the driver.
This is only done for default socket provider. The default timeout is
left to be infinite.

Implemented `Connection.setNetworkTimeout` API to make it possible to
change the maximum amount of time to wait for server replies after the
connection is established.

The connection that has timed out is forced to close. New subsequent
operations requested on such connection must fail right away.
The corresponding checks are embedded into relevant APIs.

Closes #38
@Totktonada
Copy link
Member

Pushed to connector-1.8.jdbc.

The review and the discussion are here (the link is to the last message): https://www.freelists.org/post/tarantool-patches/PATCH-jdbc-add-connection-timeout-configuration-and-handling,5

Totktonada pushed a commit that referenced this issue Dec 11, 2018
Added connection property `socketTimeout` to allow user control over
network timeout before actual connection is returned by the driver.
This is only done for default socket provider. The default timeout is
left to be infinite.

Implemented `Connection.setNetworkTimeout` API to make it possible to
change the maximum amount of time to wait for server replies after the
connection is established.

The connection that has timed out is forced to close. New subsequent
operations requested on such connection must fail right away.
The corresponding checks are embedded into relevant APIs.

Closes #38
Totktonada pushed a commit that referenced this issue Dec 11, 2018
Added connection property `socketTimeout` to allow user control over
network timeout before actual connection is returned by the driver.
This is only done for default socket provider. The default timeout is
left to be infinite.

Implemented `Connection.setNetworkTimeout` API to make it possible to
change the maximum amount of time to wait for server replies after the
connection is established.

The connection that has timed out is forced to close. New subsequent
operations requested on such connection must fail right away.
The corresponding checks are embedded into relevant APIs.

Closes #38
Totktonada pushed a commit that referenced this issue Dec 11, 2018
Added connection property `socketTimeout` to allow user control over
network timeout before actual connection is returned by the driver.
This is only done for default socket provider. The default timeout is
left to be infinite.

Implemented `Connection.setNetworkTimeout` API to make it possible to
change the maximum amount of time to wait for server replies after the
connection is established.

The connection that has timed out is forced to close. New subsequent
operations requested on such connection must fail right away.
The corresponding checks are embedded into relevant APIs.

Closes #38
Totktonada pushed a commit that referenced this issue Dec 12, 2018
Added connection property `socketTimeout` to allow user control over
network timeout before actual connection is returned by the driver.
This is only done for default socket provider. The default timeout is
left to be infinite.

Implemented `Connection.setNetworkTimeout` API to make it possible to
change the maximum amount of time to wait for server replies after the
connection is established.

The connection that has timed out is forced to close. New subsequent
operations requested on such connection must fail right away.
The corresponding checks are embedded into relevant APIs.

Closes #38
Totktonada pushed a commit that referenced this issue Dec 12, 2018
Added connection property `socketTimeout` to allow user control over
network timeout before actual connection is returned by the driver.
This is only done for default socket provider. The default timeout is
left to be infinite.

Implemented `Connection.setNetworkTimeout` API to make it possible to
change the maximum amount of time to wait for server replies after the
connection is established.

The connection that has timed out is forced to close. New subsequent
operations requested on such connection must fail right away.
The corresponding checks are embedded into relevant APIs.

Closes #38
Totktonada pushed a commit that referenced this issue Dec 12, 2018
Added connection property `socketTimeout` to allow user control over
network timeout before actual connection is returned by the driver.
This is only done for default socket provider. The default timeout is
left to be infinite.

Implemented `Connection.setNetworkTimeout` API to make it possible to
change the maximum amount of time to wait for server replies after the
connection is established.

The connection that has timed out is forced to close. New subsequent
operations requested on such connection must fail right away.
The corresponding checks are embedded into relevant APIs.

Closes #38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants