Bug #43173 connection timeout too soon
Submitted: 25 Feb 2009 9:59 Modified: 4 Mar 2009 8:23
Reporter: Teresa Miyar Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.7 OS:Any
Assigned to: CPU Architecture:Any
Tags: wait_timeout

[25 Feb 2009 9:59] Teresa Miyar
Description:
Hi,

Using connector version 5.1.7 and mysql server 5.0.45 I get the following error too often:
The last packet successfully received from the server was137428 milliseconds ago.The last packet sent successfully to the server was 137428 milliseconds ago, which is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem., state/code: 08S01/0

Setting for wait_timeout is 8 hours far more than 137428 milliseconds. If I downgrade to connector 5.0 I don't get errors any more.

Teresa

How to repeat:
Use connector version 5.1.7 and mysql server 5.0.45, connect to database and leave idle for few minutes.
[25 Feb 2009 10:58] Tonci Grgin
Hi Teresa and thanks for your report.

I am sorry but with info provided I am unable to repeat the problem.
Test environment:
  o remote MySQL 5.1.31 server on OpenSolaris x64 box
  o W2K8 x64 client with JDK1.5
  o Latest c/J 5.1 sources from bzr repo
Connection string:
-Xmx512M -XX:+UseParallelGC -Djavax.net.debug=all -Dcom.mysql.jdbc.java6.javac=C:\jvms\jdk1.6.0\bin\javac.exe -Dcom.mysql.jdbc.java6.rtjar=C:\jvms\jdk1.6.0\jre\lib\rt.jar -Dcom.mysql.jdbc.testsuite.url.default=jdbc:mysql://opensol:XX/test?user=root&password=**&autoReconnect=false

 	Properties props = new Properties();
	props.setProperty("useInformationSchema","true");
	Connection PropConn = getConnectionWithProps(props);
	DatabaseMetaData dbmd = PropConn.getMetaData();
	ResultSet rsPropConn = dbmd.getSchemas();
	ResultSetMetaData rsmt = rsPropConn.getMetaData(); <<< BP, wait 5-6 min.
	for (int i = 1; i <= rsmt.getColumnCount(); i++) {
	      System.out.println("Col #"+i+" => "+ rsmt.getColumnName(i));
	    }	

Output:
Loading JDBC driver 'com.mysql.jdbc.Driver'
Done.

Done.

Connected to 5.1.31-log
...waiting here...
Col #1 => TABLE_SCHEM
Col #2 => TABLE_CATALOG
[25 Feb 2009 11:06] Teresa Miyar
Hi is using MySQL server 5.0. and the connector 5.1.7
[25 Feb 2009 12:19] Teresa Miyar
What I found related to this problem: http://lists.mysql.com/commits/48288
and also that after reverting to connector 5.0. things work again. I've tried to find any documentation on if I have to use mysql server 5.1.x with the connector 5.1.x, but didnt find anything on the matter.
[25 Feb 2009 16:57] Tonci Grgin
Teresa, please check latest c/J snapshots and retest.
http://downloads.mysql.com/snapshots/mysql-connector-java-5.1/mysql-connector-java-5.1-nig...
[26 Feb 2009 13:35] Teresa Miyar
Hi,

Cant test it today as its on production but I will set a test environment and give you a replay by the end of the week.

Teresa
[4 Mar 2009 8:16] Tonci Grgin
Teresa, any news?
[4 Mar 2009 8:23] Teresa Miyar
Hi,

still waiting for the old setup, the systems guy is still on vacation.
sorry for the delay.

Teresa