Sunday, May 17, 2009

Hibernate problem: "MESSAGE: Broken pipe"

Hi all,

short update - after a long while of running smoothly, the portlet with the hibernate DB connection had a small problem (again).

This time the error was:
04:12:22,792 ERROR [JDBCExceptionReporter:101] 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:2744)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1612)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3256)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1313)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1448)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1808)
at org.hibernate.loader.Loader.doQuery(Loader.java:697)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2228)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
at org.hibernate.loader.Loader.list(Loader.java:2120)
at org.hibernate.hql.classic.QueryTranslatorImpl.list(QueryTranslatorImpl.java:935)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at com.liferay.portal.dao.orm.hibernate.QueryImpl.list(QueryImpl.java:78)
at com.liferay.portal.dao.orm.hibernate.QueryImpl.list(QueryImpl.java:73)
A short webresearch pointed out a problem with transaction handling and hinted at two possible solutions:
  1. Wrong coding regarding "commit" of transactions
  2. Usage of a parameter to "autocommit"
(Sources:
http://www.mikeschubert.com/archives/2006/08/javanetsocketex.html
http://forums.mysql.com/read.php?39,196323,198960#msg-198960)
)

Trying not to focus on hibernate problems but rather on other topics I'm trying solution 2 at the moment.
I will let you know how it worked out. :)

3 comments:

  1. I'm facing the same problem with Liferay. How did you solved? Thanks, D.

    ReplyDelete
  2. Hey!can you please give us a step-by-step way on how to solve this...

    ReplyDelete
  3. thanks a lot for yr useful solution :)

    ReplyDelete

I'm happy about every feedback! :)