Bug #4770 Java JDBC driver has dead lock
Submitted: 27 Jul 2004 16:57 Modified: 27 Jul 2004 17:39
Reporter: v d Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / J Severity:S1 (Critical)
Version:mysql-connector-java-3.0.14 OS:Windows (MS windows)
Assigned to: Mark Matthews CPU Architecture:Any

[27 Jul 2004 16:57] v d
Description:
I can get dead lock consistently doing this.  What I do is creating about 10 connections, one in each thread.  For each connection I create a query through prepared statement (create prepared statement, set the parameters, execute query, close both the resultset and the prepared statement).  Repeat this thousands of times.  If there is an exceptions, just try to close the connection and repeat this.  While hitting the server, I pull out the ethernet cable from the server.  Then I would shut down and start up the MySql server.  Then I plug back the cable.  I would get dead lock on one of those connections (repeat if cannot reproduce dead lock).  I am not sure where the dead lock is (whether create connection, create preparedstatement, the query itself, or the close of the query, and the prepared statement).

The query is very simple:

Select * from <table> where myindex = ?

myindex is a index.

The 1st record is read out.  myindex is set throught the prepared statement.

How to repeat:

May have to increase the number of connections to recreate the problem.
[27 Jul 2004 17:34] Mark Matthews
This is most likely not deadlock. The JDBC driver uses the standard TCP/IP socket timeout which can be up to 15 minutes on some platforms when the network has been interrupted (depending on _when_ the network went down and what 'state' your TCP/IP connection was in will determine when the network layer of your operating system detects the connection has 'died').

If you need a connection to fail 'sooner' than that when the network has been interrupted, you need to set the 'socketTimeout' property as documented at http://dev.mysql.com/doc/connector/j/en/index.html#id2801179
[27 Jul 2004 17:39] Mark Matthews
This is most likely not deadlock. The JDBC driver uses the standard TCP/IP socket timeout which can be up to 15 minutes on some platforms when the network has been interrupted (depending on _when_ the network went down and what 'state' your TCP/IP connection was in will determine when the network layer of your operating system detects the connection has 'died').

If you need a connection to fail 'sooner' than that when the network has been interrupted, you need to set the 'socketTimeout' property as documented at http://dev.mysql.com/doc/connector/j/en/index.html#id2801179