Re: MySQL java.net.SocketException: Broken pipe
Posted by: Simon Haldon
Date: February 23, 2006 10:48AM

Was this ever resolved? I am passing the same connection object to a chain of queries and it suddenly gives this error, after successfully executing half a dozen queries that reference the self same connection object.

The error occurs seemingly at random.

If idle connections are closed after 8 hours, fine - but this connection has just been used several times in the last few milliseconds. Why would it then time out? If someone can clarify this I'd be grateful, I have started coding retry logic in all my methods that exec preparedstatements, but I would like to understand exactly what is going on.

I have autoreconnect=true in my connection string. It's MySQL 4.1.16, connector/J 3.1.7.

Here's my error down to the preparedstatement call:

com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: Broken pipe

STACKTRACE:

java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2616)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2547)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1512)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2376)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2297)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1860)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1957)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1880)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1741)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:101)

Thanks in advance for any help on this!

Options: ReplyQuote


Subject
Written By
Posted
Re: MySQL java.net.SocketException: Broken pipe
February 23, 2006 10:48AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.