Here are the likely offenders from the Connection source:
this.netBufferLength = Integer.parseInt((String) this.serverVariables.get("net_buffer_length"));
this.maxAllowedPacket = Integer.parseInt((String) this.serverVariables.get("max_allowed_packet"));
The code is clearly not ready for the server to return "" for these variables.
maydox wrote:
Our mysql 4.1 DB recently hit the maximum number of allowed connections, immediate effects were that replication began to fail and our Java apps running through tomcat could no longer establish connections (even after more became available).
Here is the stack trace (using mysql-connector-java-5.0.5.jar):
java.lang.NumberFormatException
MESSAGE: For input string: ""
STACKTRACE:
java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:468)
at java.lang.Integer.parseInt(Integer.java:497)
at com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:4031)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2756)
at com.mysql.jdbc.Connection.<init>(Connection.java:1553)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at org.apache.tomcat.dbcp.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37)
at org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
...
What is puzzling is that the PHP applications continued to function while the driver continued to throw this stack trace. Tomcat was only able to reestablish a connection through the connector after the db was restarted.
Has anyone seen this type of behavior before? I searched the bug database and this archive and haven't seen anything quite like this.