Connection timeout with MySQL database
問題
Database operations timeout after period of inactivity.
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)
原因
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.
ソリューション
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.