Connection timeout with MySQL database

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

Database operations timeout after period of inactivity.

The following appears in the atlassian-fisheye-YYYY-MM-DD.log

The last packet successfully received from the server was XXX milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

Cause

The MySQL server closes connections due to inactivity but Fisheye/Crucible doesn't know about this and tries to perform database operations on the closed connection.

Resolution

Fisheye/Crucible use a c3p0 configuration which will discard connections after 1800 seconds, so if the MySQL wait_timeout is set to 1800 the problem can be mitigated.

wait_timeout can be set on a per connection basis but the value is hard coded into the app and changing this value isn't possible via jdbc parameters.

The alternative method is to set the wait_timeout to 1800 on your MySQL server:

http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_wait_timeout

Hint: you should configure this value in your my.ini file.

Last modified on Jul 31, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.