Bug in BufferedInputStream causing INSERT to hang?
Posted by: Paul Smith
Date: January 20, 2005 08:09AM

I need some help from a MySQL expert!!

I have an issue that has only occurred once whereby my application hangs when doing a Connection.commit(). I need to know why it happened. When my application was hung, I did a CTRL-Break to get stack traces from my threads, and I suspect the section below to be the area that is causing me a problem.

The last line in my code before it enters the code from the com.mysql package is a Connection.commit(), having just done a PreparedStatement.executeUpdate() to a MyISAM table.

I am using version 3.0.15 of Connector/J and MySQL Server version 4.0.20. I have seen a release note for version 3.1.5 that suggests there may be a problem using BufferedInputStream ["Use our own implementation of buffered input streams to get around blocking behavior of java.io.BufferedInputStream"].

I know people are always quick to suggest moving to a newer version of Connector/J, but I would like some level of confidence that this is the cause of my problem. I am unable to reproduce this problem regularly (it has only happened once), so if I move to 3.1.5 the problem may appear to have gone and appear after, say, 10 days of continuous running.

"MessageListenerThread - JMS_TQ4" prio=5 tid=0x02f8eb78 nid=0xa20 runnable [360f
000..360fd8c]
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
- locked <0x105fe290> (a java.io.BufferedInputStream)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1391)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1570)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1929)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1224)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2244)
- locked <0x105fe030> (a java.lang.Object)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2204)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2185)
at com.mysql.jdbc.Connection.commit(Connection.java:1149)

Many Thanks,
Paul

Options: ReplyQuote


Subject
Written By
Posted
Bug in BufferedInputStream causing INSERT to hang?
January 20, 2005 08:09AM


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.