krummas / DrizzleJDBC

A BSD licensed JDBC driver for Drizzle and MySQL
BSD 3-Clause "New" or "Revised" License
31 stars 22 forks source link

Could not ping, broken pipe in MariaDB Drizzle JDBC #17

Closed Haseena closed 11 years ago

Haseena commented 11 years ago

I have an java application which uses mariadb server. Drizzle jdbc is used for connecting the mariadb server from java side. Sometimes, I got an error, broken pipe.

Iam using ubuntu12.04, latest drizzle jdbc driver(1.2) and mariadb 5.5.29.

Please see the error log :

java.sql.SQLNonTransientConnectionException: Could not ping: Broken pipe at org.drizzle.jdbc.internal.SQLExceptionMapper.get(SQLExceptionMapper.java:97) at org.drizzle.jdbc.DrizzleConnection.isValid(DrizzleConnection.java:950) at

.............................................

org.eclipse.cdt.dsf.concurrent.RequestMonitor$2.run(RequestMonitor.java:298) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:165) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:679) Caused by: org.drizzle.jdbc.internal.common.QueryException: Could not ping: Broken pipe at org.drizzle.jdbc.internal.mysql.MySQLProtocol.ping(MySQLProtocol.java:424) at org.drizzle.jdbc.DrizzleConnection.isValid(DrizzleConnection.java:948) ... 14 more Caused by: java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109) at java.net.SocketOutputStream.write(SocketOutputStream.java:153) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140) at org.drizzle.jdbc.internal.mysql.packet.commands.MySQLPingPacket.send(MySQLPingPacket.java:47) at org.drizzle.jdbc.internal.mysql.MySQLProtocol.ping(MySQLProtocol.java:419) ... 15 more

krummas commented 11 years ago

Hi

Is there a specific query that makes this happen?

Haseena commented 11 years ago

Hi,

This does not happen for a specific query. We have noticed this behavior when a query is executed after the application is kept idle for a while. However, it is possible to execute the query from the command line (using mysql client) at the same time.

Regards,

Haseena

krummas commented 11 years ago

yeah, it is probably a bug in .isValid() - it should not throw exception if the connection is down, just return false

Haseena commented 11 years ago

What could be the reason for losing connection?

krummas commented 11 years ago

if you have a large connection pool, there could be a firewall between your app and the database that drops idle connections?

Haseena commented 11 years ago

From where we get the updated jar file?

krummas commented 11 years ago

ill try to deploy a snapshot, hold on

krummas commented 11 years ago

https://oss.sonatype.org/content/repositories/snapshots//org/drizzle/jdbc/drizzle-jdbc/1.3-SNAPSHOT/drizzle-jdbc-1.3-20130402.115238-1.jar

Haseena commented 11 years ago

Thanks for your valuable help and support. Its working fine.