Error Message:
com.mysql.jdbc.CommunicationsException: Communications link failure Last packet sent to the server was 0 ms ago
Reason:
The value of wait_timeout in my.cnf(linux) or my.ini(windows), is the maximum idle duration of database link. As the idle duration is up, Mysql will disconnect think link.
123 Flash Chat server uses the database connection pool technology to promote the efficiency of databases communication, which can avoid database from reconnecting each time when executing SQL command. If the idle duration of server database connection pool is too long, MySQL may disconnect the link.
Open server/etc/Mysql.xml, there is a node house-keeping-sleep-time, which is the time when the house keeping thread sleeps for between checks on availability of database connection. If this value is larger than the value of wait_timeout, the chat server can’t check the disconnection of database links with MySQL in time. Then a disconnected database link will be used, the above error will be reported when executing SQL command,. And chat server may go down which makes it even worse
Solutions:
- Check the value of wait_timeout (second) in my.cnf(linux) or my.ini(windows).
- According to the wait_timeout value, please open server/etc/Mysql.xml, find house-keeping-sleep-time (millisecond, second*1000), set the value wait_timeout*1000/2.
- Restart chat server, and login MySQL. Please use show full processlist to check regularly whether MySQL is still connecting after the duration that set in Mysql.xml, which is to make sure the problem has been solved.