user1149201
user1149201

Reputation: 31

Getting java.lang.StackOverflowError when executing mysql query

I have this exception raised from time to time causing my mysql calls to fail.

   Caused by: java.lang.StackOverflowError
           at java.net.SocketOutputStream.socketWrite0(Native Method)
           at java.net.SocketOutputStream.socketWrite(Unknown Source)
           at java.net.SocketOutputStream.write(Unknown Source)
           at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
           at java.io.BufferedOutputStream.flush(Unknown Source)
           at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3251)
           at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1932)
           at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
           at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2548)
           at com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4916)
   .....

I am using mysql jdbc 5.1.7 with c3p0. JVM is running in a linux 64 server. I found a related bug in mysql jdbc 3.0.7 fixed in version 3.0.8. So I suppose this is not my case.

It seems to be random behaviour since for most executions there is no error, but it happens often every week. Could this be caused by mysql server communication failure? Any ideas are welcome

Upvotes: 1

Views: 1543

Answers (1)

user1149201
user1149201

Reputation: 31

Found the cause of the the problem. Seems that it was due to dropped idle connections in mysql server. The autoReconnect=true in mysql url fixed the issue for me.

Upvotes: 2

Related Questions