[CONJ-682] java.sql.SQLNonTransientConnectionException: No connection available within the specified time Created: 2019-02-08  Updated: 2020-12-10  Resolved: 2019-03-05

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 2.4.0
Fix Version/s: 1.7.6, 2.4.1

Type: Bug Priority: Major
Reporter: Vaclav Havlik Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None
Environment:

Debian 8. java-8-openjdk-amd64.


Attachments: Java Source File TcpRstMain2.java     PNG File mariadb_jdbc_bug.png    
Issue Links:
Relates
relates to CONJ-848 Pool correction for java 7 connection... Closed

 Description   

After wait_timeout expires, server sends TCP RST to all TCP connections. Then JDBC tries to create another TCP connection, which seems successful, but for some reason JDBC closes this new TCP connection immediately.

I use Maven artifact
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>2.4.0</version>

Then MariaDbPoolDataSource.getConnection() throws
java.sql.SQLNonTransientConnectionException: No connection available within the specified time (option 'connectTimeout': 30,000 ms)

What is strange - When I step through in debugger, then it works.

To reproduce:
1.
Set up wait_timeout=60 in my.cnf .

2.
Run attached TcpRstMain2.java .

3.
See attached Wireshark.

Thank you.



 Comments   
Comment by Vaclav Havlik [ 2019-02-11 ]

Event if I do

ds.setLoginTimeout(50000);

then it fails the same, with message
o connection available within the specified time (option 'connectTimeout': 50,000,000 ms)
.

Comment by Diego Dupin [ 2019-02-14 ]

reproduced.
If connection receive an RST during validation, the pool will end up throwing connection timeout exception in place of reusing another connection.

Generated at Thu Feb 08 03:17:32 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.