[MDEV-21596] Draft: InnoDB reports DEADLOCK of threads detected! Created: 2020-01-29  Updated: 2020-06-14

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Matthias Leich Assignee: Matthias Leich
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-22890 DEADLOCK of threads detected: row0sel... Closed

 Description   

thread2:
    SELECT `k` FROM oltp3 WHERE `id` BETWEEN _smallint_unsigned AND _smallint_unsigned ;
thread2_connect:
    ;
thread2_init:
    ;
thread1:
    UPDATE IGNORE oltp3 SET `k` = `k` + 1 WHERE `id` = _smallint_unsigned |
    UPDATE IGNORE oltp3 SET `k` = `k` + 1 WHERE `id` = _smallint_unsigned |
    FLUSH TABLE oltp3 FOR EXPORT |
    LOCK TABLE t9 WRITE ;
thread1_connect:
    ;
thread1_init:
    ;
 
Only two sessions are required.
The table oltp3 exists (id is PK, k is indexed) and contains 1000 rows.
The table t9 does not exist at all.
 
After around 60 - 90 seconds the DB server aborts with
# 2020-01-29T14:25:19 [124160] | DEADLOCK of threads detected!
# 2020-01-29T14:25:19 [124160] | rw-lock 0x7f89c005b090 --Thread 140230162839296 has waited at row0sel.cc line 3511 for 0.00 seconds the semaphore:
# 2020-01-29T14:25:19 [124160] | X-lock on RW-latch at 0x7f89c005b090 created in file buf0buf.cc line 1534
# 2020-01-29T14:25:19 [124160] | a writer (thread id 140229155460864) has reserved it in mode  exclusive
# 2020-01-29T14:25:19 [124160] | number of readers 0, waiters flag 1, lock_word: 0
# 2020-01-29T14:25:19 [124160] | Last time write locked in file row0row.cc line 1300
# 2020-01-29T14:25:19 [124160] | Locked: thread 140229155460864 file row0row.cc line 1300  X-LOCK
# 2020-01-29T14:25:19 [124160] | Locked: thread 140229155460864 file row0row.cc line 1300  X-LOCK
# 2020-01-29T14:25:19 [124160] | rw-lock 0x7f8978079418 --Thread 140230163142400 has waited at row0quiesce.cc line 675 for 0.00 seconds the semaphore:
# 2020-01-29T14:25:19 [124160] | X-lock (wait_ex) on RW-latch at 0x7f8978079418 created in file dict0dict.cc line 2072
# 2020-01-29T14:25:19 [124160] | a writer (thread id 140230163142400) has reserved it in mode  wait exclusive
# 2020-01-29T14:25:19 [124160] | number of readers 1, waiters flag 0, lock_word: ffffffff
# 2020-01-29T14:25:19 [124160] | Last time write locked in file btr0cur.cc line 1474
# 2020-01-29T14:25:19 [124160] | Locked: thread 140230162839296 file btr0cur.cc line 1506  S-LOCK
# 2020-01-29T14:25:19 [124160] | Locked: thread 140230162839296 file btr0cur.cc line 1506  S-LOCK
# 2020-01-29T14:25:19 [124160] | rw-lock 0x7f8978089578 --Thread 140229155460864 has waited at btr0cur.cc line 1506 for 0.00 seconds the semaphore:
# 2020-01-29T14:25:19 [124160] | S-lock on RW-latch at 0x7f8978089578 created in file dict0dict.cc line 2072
# 2020-01-29T14:25:19 [124160] | a writer (thread id 140230163142400) has reserved it in mode  exclusive
# 2020-01-29T14:25:19 [124160] | number of readers 0, waiters flag 1, lock_word: 0
# 2020-01-29T14:25:19 [124160] | Last time write locked in file row0quiesce.cc line 675
# 2020-01-29T14:25:19 [124160] | Locked: thread 140230163142400 file row0quiesce.cc line 675  X-LOCK
# 2020-01-29T14:25:19 [124160] | 2020-01-29 14:24:51 0 [ERROR] [FATAL] InnoDB: ######################################## Deadlock Detected!
# 2020-01-29T14:25:19 [124160] | 200129 14:24:51 [ERROR] mysqld got signal 6 ;
 
Replay on actual 10.5 (2020-01-27) compiles with debug.
No replay or other issue on actual 10.4. or 10.5 compiled without debug.


Generated at Thu Feb 08 09:08:21 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.