Full text of log message:
Log Message: An error occurred while grabbing new users
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 44,567,434 milliseconds ago. The last packet sent successfully to the server was 44,567,434 milliseconds ago. 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.
This is strange to me because that is over 10 hours. My program was happily and successfully running, including communicating with the database, over the previous 10 hours. The best hypothesis I have is that a single connection in the pool was stale but in that case I don’t know why this wouldn’t be cleaned up automatically or if this exception was related to that operation. How should I handle this?
Am using c3p0 connection pool.
c3p0 has lots of means of testing Connections and preventing them from timing out or going stale. the simplest way to solve the particular problem you are seeing would be to simply set the config parameter maxIdleTime to, say, 8 hours (28800 seconds).
but you might want to start testing Connections in general, for example, by setting idleConnectionTest period to something frequent and setting testConnectionOnCheckin to true. See…
http://www.mchange.com/projects/c3p0/#configuring_connection_testing
http://www.mchange.com/projects/c3p0/#configuration_properties