Bug #31136 deadlock in MySQL jdbc driver (version 5.0.0-beta)
Submitted: 21 Sep 2007 16:40 Modified: 30 Apr 2013 9:22
Reporter: Horatiu Jula Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version: OS:Any
Assigned to: Alexander Soklakov CPU Architecture:Any
Tags: deadlock

[21 Sep 2007 16:40] Horatiu Jula
Description:
it happens between between ServerPreparedStatement.realClose() and Connection.getCatalog().

How to repeat:
		String conUrl = "jdbc:mysql://localhost:3306/TestDB";
		try {
			Class.forName("com.mysql.jdbc.Driver").newInstance();
			final Connection con = DriverManager.getConnection(conUrl, "user", "password");
			
			Thread t1 = new Thread(new Runnable() {
				public void run() {
					try {
						PreparedStatement stm = con.prepareStatement("SELECT * from Table1");
						stm.executeQuery();
					} 
					catch (Exception e) {
						e.printStackTrace();
					}
				}				
			});
			Thread t2 = new Thread(new Runnable() {
				public void run() {
					try {
						con.close();
					} 
					catch (Exception e) {
						e.printStackTrace();
					}
				}				
			});
			
			t1.start();
			t2.start();
			
			t1.join();
			t2.join();
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
[22 Sep 2007 7:13] Mark Matthews
Please try a newer version of the driver. Version 5.0 has been in GA at release 7 for some time now, and you're reporting a bug in 5.0.0 _beta_.
[22 Oct 2007 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[30 Apr 2013 9:22] Alexander Soklakov
Hi Horatiu,

There is no feedback since Sep 2007 and synchronization model changed significantly since c/J 5.0, so I close this report as "Can't repeat".
Please, feel free to reopen it if the problem still exists in current driver.