Description:
In heavily-loaded environment, communication fails at times like this.
java.lang.RuntimeException: com.mysql.jdbc.CommunicationsException: Communications link failure
Last packet sent to the server was 36141 ms ago.
at mysql.ThreadConnection.getConnection(ThreadConnection.java:101)
at mysql.ThreadConnection.run(ThreadConnection.java:53)
Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure
Last packet sent to the server was 36141 ms ago.
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1070)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2103)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:718)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:298)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at mysql.ThreadConnection.getConnection(ThreadConnection.java:98)
... 1 more
Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure
Last packet sent to the server was 36139 ms ago.
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1070)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2985)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2871)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3414)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:910)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3923)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1273)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2031)
... 7 more
Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2431)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2882)
... 13 more
I tested this behavior on Virtual and Real Server.
How to repeat:
(1) Make a virtual machine with CentOS 5.x / 256MB RAM. (Real machine will do).
(2) Run 100-query on the machine.
(3) Run stress tool with these options (at the same time (2))
shell> stress --cpu 1000 --io 10 --vm 2 --vm-bytes 128M --timeout 60s
Project Page is here.
http://weather.ou.edu/~apw/projects/stress/
You sometime see the error message.
Suggested fix:
[Suggested fix]
N/A
[Workaround]
Implement retry procedure to the application program.