I was working last night on an application built on the following platform:
Railo 3.0
Centos 5.1
Apache2
MySql 5
The application isn’t doing anything crazy… just some queries and some file uploads. I kept getting this though:
Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.io.EOFException STACKTRACE: java.io.EOFException at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1956) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2368) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2867) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1616) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1708) at com.mysql.jdbc.Connection.execSQL(Connection.java:3249) at com.mysql.jdbc.Connection.execSQL(Connection.java:3178) at com.mysql.jdbc.Statement.execute(Statement.java:711) at railo.runtime.type.QueryImpl.<init>(QueryImpl.java:175) at railo.runtime.tag.Query.execute(Query.java:406) at railo.runtime.tag.Query.doEndTag(Query.java:340) at …
It took me a bit, but I finally figured out how to handle it…
In /etc/my.cnf
Adjust the ‘wait_timeout’ directive to a reasonably high number. It is in seconds… and default is set to 30 seconds.
wait_timeout = 1200
The second thing you want to do is make sure that within the Railo Web Administrator’s datasource dialog, your ‘Connection timeout (in minutes)’ is set to a number that is significantly lower than MySql’s ‘wait_timeout’. What this does is it makes sure that Railo properly closes inactive database connections before MySql does.