Bug #60332 Deadlock of innodb

Submitted: 4 Mar 2011 9:59 Modified: 4 Mar 2011 22:52
Reporter: yuan chaohua Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.1.53 OS:Linux
Assigned to: CPU Architecture:Any

[4 Mar 2011 9:59] yuan chaohua
Description:
Hi,

Could someone have a look at this deadlock? I do not know if it is really a bug.
Thanks for give any idea.

The deadlock from show innodb status:

------------------------
LATEST DETECTED DEADLOCK
------------------------
110302 18:05:52
*** (1) TRANSACTION:
TRANSACTION 0 8993736, ACTIVE 0 sec, process no 3173, OS thread id 1207671104 inserting
mysql tables in use 1, locked 1
LOCK WAIT 3 lock struct(s), heap size 1216, 2 row lock(s)
MySQL thread id 161906, query id 129228708 sha-wks-aa844.ubisoft.org 10.192.81.170 ssopcuatn update
insert into roomidmapping (lineid, rid, gid) values (3, 101, 773)
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 0 page no 5493 n bits 200 index `PRIMARY` of table `sso_pc_uat_n`.`roomidmapping` trx id 0 8993736 lock_mode X insert intention waiting
Record lock, heap no 1 PHYSICAL RECORD: n_fields 1; compact format; info bits 0
 0: len 8; hex 73757072656d756d; asc supremum;;

*** (2) TRANSACTION:
TRANSACTION 0 8993737, ACTIVE 0 sec, process no 3173, OS thread id 1217788224 inserting, thread declared inside InnoDB 500
mysql tables in use 1, locked 1
3 lock struct(s), heap size 1216, 2 row lock(s)
MySQL thread id 161905, query id 129228709 sha-wks-aa844.ubisoft.org 10.192.81.170 ssopcuatn update
insert into roomidmapping (lineid, rid, gid) values (3, 101, 772)
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 0 page no 5493 n bits 200 index `PRIMARY` of table `sso_pc_uat_n`.`roomidmapping` trx id 0 8993737 lock_mode X
Record lock, heap no 1 PHYSICAL RECORD: n_fields 1; compact format; info bits 0
 0: len 8; hex 73757072656d756d; asc supremum;;

*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 0 page no 5493 n bits 200 index `PRIMARY` of table `sso_pc_uat_n`.`roomidmapping` trx id 0 8993737 lock_mode X insert intention waiting
Record lock, heap no 1 PHYSICAL RECORD: n_fields 1; compact format; info bits 0
 0: len 8; hex 73757072656d756d; asc supremum;;

*** WE ROLL BACK TRANSACTION (2)

The table:

 show create table roomidmapping;
-------------------------------------------------------------------------------+
| roomidmapping | CREATE TABLE `roomidmapping` (
  `lineid` int(11) NOT NULL,
  `rid` int(11) NOT NULL,
  `gid` int(11) DEFAULT NULL,
  PRIMARY KEY (`rid`,`lineid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+---------------+---------------------------------------------------------------

The transaction level:
tx_isolation                            | REPEATABLE-READ

Thanks

How to repeat:
It seems only happened when lots of concurrent inserts/select on the table.
[4 Mar 2011 10:06] yuan chaohua
on one session 
begin; insert into roomidmapping (lineid, rid, gid) values (3, 101, 773); end;//

on a different session 
try insert into roomidmapping (lineid, rid, gid) values (3, 101, 772);end;//

will repeat this deadlock.
[4 Mar 2011 10:22] yuan chaohua
The "end" should be commit. so do not commit the first transaction and execute the second one the deadlock will appear.
[4 Mar 2011 22:52] Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

InnoDB correctly detected deadlock in your case. This is not a bug.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
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.