Connection timeout with MySQL database
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
Database operations timeout after period of inactivity.
The following appears in the atlassian-fisheye-YYYY-MM-DD.log
1
2
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.
Was this helpful?