Bug #11994 mysql 4.1.12 deadlock on a SMP box
Submitted: 18 Jul 2005 4:30 Modified: 22 Oct 2005 6:51
Reporter: Sivakumar K Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1.12 OS:Linux (Redhat Enterprise Linux 3)
Assigned to: CPU Architecture:Any

[18 Jul 2005 4:30] Sivakumar K
Description:
On a SMP rhel-3 server, MySQL server deadlocks with the following sequence of operations performed by two threads concurrently:

How to repeat:
The following sets of statments from a java program can be used to repeat.
Tables creation:

                stmt.executeUpdate( "drop database if exists test_bdb_deadlock");
                stmt.executeUpdate( "create database test_bdb_deadlock");
                stmt.executeUpdate( "use test_bdb_deadlock");
                stmt.executeUpdate( "create table table1 (testid integer(10), name char(20)) type=BDB");
                stmt.executeUpdate( "create table table2 (testid integer(10), name char(20)) type=BDB");
                stmt.executeUpdate( "insert into table1 values (1,'test')");
                stmt.executeUpdate( "insert into table2 values (1,'test')");

Thread 0:
                   Statement stmt,stmt2;
                    ResultSet rs;
                    stmt = con1.createStatement();
                    stmt.executeUpdate( "update table1 set name = 'testt2'  where testid = 1");
                    stmt2 = con2.createStatement();
                    stmt2.executeUpdate( "update table2 set name = 'testt2'  where testid = 1");
                    System.err.println("Thread 0 after 2 updates, before select");
                    stmt2.execute( "select * from table1 where testid=1");
                    System.err.println("Thread 0 after SElect");
Thread 1:
                    System.err.println("Thread 1 going to sleep");
                    Thread.sleep(5000);
                    System.err.println("Thread 1 after the sleep");
                    Statement stmt;
                    System.err.println("Thread 1 befiore CRT STMT");
                    stmt = con1.createStatement();
                    System.err.println("Thread 1 befiore select");
                    stmt.execute( "select * from table2 where testid=1");
                    System.err.println("Thread 1 after insert  ");
[18 Aug 2005 23:22] Shawn Mitchell
Just an FYI, I'm seeing this on CentOS 4.0, with latests patches applied (RHE4.0) running on a Dell 6600 with 4 2.8Ghz Xeon CPU's, HT Enabled, and 8GB ram. (OS see's 8CPU's)

Server version:         4.1.10a
Protocol version:       10
mysql-server-4.1.10a-2.RHEL4.1

If 2+ queries are passed through at the same time, the queries deadlock, the CPU usage goes to 99% CPU usage.

Other queries will go through just fine, but if two more queries exactly the same hit at exactly the same time, those too deadlock.

I have 3 threads currently deadlocked for 2 hours now.
[22 Sep 2005 6:51] Valeriy Kravchuk
Thank you for your bug report. 

Have you experienced the same behaviour with other (newer) versions of MySQL (4.1.14, 5.0.x?) and with other storage engines, or it is a BDB-specific problem only? Have you tried to repeat it without Java, using 2 standard mysql client session?
[22 Oct 2005 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".