[MDEV-27526] Spider: SIGSEGV in ha_spider::lock_tables and Assertion `thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt' failed in ha_commit_trans on START TRANSACTION Created: 2022-01-17  Updated: 2022-11-07  Resolved: 2022-01-20

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Spider
Affects Version/s: 10.5, 10.6, 10.7, 10.8
Fix Version/s: N/A

Type: Bug Priority: Critical
Reporter: Roel Van de Paar Assignee: Nayuta Yanagisawa (Inactive)
Resolution: Duplicate Votes: 0
Labels: not-10.2, not-10.3, not-10.4, regression

Issue Links:
Duplicate
duplicates MDEV-27239 Spider: Assertion `thd->transaction->... Closed
Relates
relates to MDEV-29962 SIGSEGV in ha_spider::lock_tables on ... Stalled
relates to MDEV-27239 Spider: Assertion `thd->transaction->... Closed
relates to MDEV-27240 SIGSEGV in ha_spider::store_lock on L... Closed

 Description   

Split from MDEV-27240. Present in MDEV-27240 postfix branch. For debug builds, it runs into the MDEV-27239 assert.

INSTALL PLUGIN spider SONAME 'ha_spider.so';
CREATE TABLE t (c INT KEY,c2 INT,INDEX i (c2)) ENGINE=SPIDER;
ALTER TABLE t ADD c4 TIME AFTER c2;
FLUSH TABLE t WITH READ LOCK;
invalid;
START TRANSACTION WITH CONSISTENT SNAPSHOT,READ ONLY;

Leads to:

10.7.2 c669e764d86a5b575df41d287947816878e21697 (Optimized)

Core was generated by `/test/MD150122-mariadb-10.7.2-linux-x86_64-opt/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000014c67014f2f1 in ha_spider::lock_tables (
    this=this@entry=0x14c5f805c970)
    at /test/10.7_opt/storage/spider/ha_spider.cc:16410
16410	        if (
[Current thread is 1 (Thread 0x14c6840ad700 (LWP 1287155))]
(gdb) bt
#0  0x000014c67014f2f1 in ha_spider::lock_tables (this=this@entry=0x14c5f805c970) at /test/10.7_opt/storage/spider/ha_spider.cc:16410
#1  0x000014c67014f808 in ha_spider::external_lock (this=0x14c5f805c970, thd=<optimized out>, lock_type=2) at /test/10.7_opt/storage/spider/ha_spider.cc:1350
#2  0x00005604afadeef4 in handler::ha_external_lock (this=0x14c5f805c970, thd=thd@entry=0x14c5f8000c58, lock_type=lock_type@entry=2) at /test/10.7_opt/sql/handler.cc:7042
#3  0x00005604afbf733a in handler::ha_external_unlock (thd=0x14c5f8000c58, this=<optimized out>) at /test/10.7_opt/sql/handler.h:3515
#4  unlock_external (count=<optimized out>, table=0x14c5f806d288, thd=0x14c5f8000c58) at /test/10.7_opt/sql/lock.cc:727
#5  mysql_unlock_tables (thd=0x14c5f8000c58, sql_lock=0x14c5f806d258, free_lock=<optimized out>) at /test/10.7_opt/sql/lock.cc:432
#6  0x00005604afbf79b8 in mysql_unlock_tables (thd=thd@entry=0x14c5f8000c58, sql_lock=<optimized out>) at /test/10.7_opt/sql/lock.cc:415
#7  0x00005604af81c5c5 in close_thread_tables (thd=thd@entry=0x14c5f8000c58) at /test/10.7_opt/sql/sql_base.cc:913
#8  0x00005604af81d38b in Locked_tables_list::unlock_locked_tables (thd=0x14c5f8000c58, this=0x14c5f8004cc0) at /test/10.7_opt/sql/sql_base.cc:2378
#9  Locked_tables_list::unlock_locked_tables (this=this@entry=0x14c5f8004cc0, thd=thd@entry=0x14c5f8000c58) at /test/10.7_opt/sql/sql_base.cc:2349
#10 0x00005604af9beffc in trans_begin (thd=thd@entry=0x14c5f8000c58, flags=3) at /test/10.7_opt/sql/transaction.cc:115
#11 0x00005604af893cca in mysql_execute_command (thd=0x14c5f8000c58, is_called_from_prepared_stmt=<optimized out>) at /test/10.7_opt/sql/sql_parse.cc:5596
#12 0x00005604af8828c6 in mysql_parse (thd=0x14c5f8000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /test/10.7_opt/sql/sql_parse.cc:8027
#13 0x00005604af88ea75 in dispatch_command (command=COM_QUERY, thd=0x14c5f8000c58, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /test/10.7_opt/sql/sql_class.h:1360
#14 0x00005604af890c67 in do_command (thd=0x14c5f8000c58, blocking=blocking@entry=true) at /test/10.7_opt/sql/sql_parse.cc:1402
#15 0x00005604af9af2a7 in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /test/10.7_opt/sql/sql_connect.cc:1418
#16 0x00005604af9af5ed in handle_one_connection (arg=arg@entry=0x5604b26d6708) at /test/10.7_opt/sql/sql_connect.cc:1312
#17 0x00005604afd1c168 in pfs_spawn_thread (arg=0x5604b268e138) at /test/10.7_opt/storage/perfschema/pfs.cc:2201
#18 0x000014c68f9e7609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#19 0x000014c68f5d5293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

10.8.0 347f6d01e3b570dce49aa1ab42cb83021905a14d (Debug)

mysqld: /test/10.8_dbg/sql/handler.cc:1635: int ha_commit_trans(THD*, bool): Assertion `thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt' failed.

10.8.0 347f6d01e3b570dce49aa1ab42cb83021905a14d (Debug)

Core was generated by `/test/MD150122-mariadb-10.8.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
[Current thread is 1 (Thread 0x147bf00ef700 (LWP 1288098))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x0000147bf24aa859 in __GI_abort () at abort.c:79
#2  0x0000147bf24aa729 in __assert_fail_base (fmt=0x147bf2640588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5626afed1a30 "thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt", file=0x5626afed0203 "/test/10.8_dbg/sql/handler.cc", line=1635, function=<optimized out>) at assert.c:92
#3  0x0000147bf24bbf36 in __GI___assert_fail (assertion=assertion@entry=0x5626afed1a30 "thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt", file=file@entry=0x5626afed0203 "/test/10.8_dbg/sql/handler.cc", line=line@entry=1635, function=function@entry=0x5626afed3fa0 "int ha_commit_trans(THD*, bool)") at assert.c:101
#4  0x00005626af384a82 in ha_commit_trans (thd=thd@entry=0x147b4c000db8, all=all@entry=true) at /test/10.8_dbg/sql/handler.cc:1635
#5  0x00005626af1fc79d in trans_begin (thd=thd@entry=0x147b4c000db8, flags=3) at /test/10.8_dbg/sql/transaction.cc:127
#6  0x00005626af07330b in mysql_execute_command (thd=thd@entry=0x147b4c000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.8_dbg/sql/sql_parse.cc:5596
#7  0x00005626af05af05 in mysql_parse (thd=thd@entry=0x147b4c000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x147bf00ee400) at /test/10.8_dbg/sql/sql_parse.cc:8027
#8  0x00005626af069ba1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x147b4c000db8, packet=packet@entry=0x147b4c00b879 "START TRANSACTION WITH CONSISTENT SNAPSHOT,READ ONLY", packet_length=packet_length@entry=52, blocking=blocking@entry=true) at /test/10.8_dbg/sql/sql_class.h:1360
#9  0x00005626af06cfe8 in do_command (thd=0x147b4c000db8, blocking=blocking@entry=true) at /test/10.8_dbg/sql/sql_parse.cc:1402
#10 0x00005626af1e69cc in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5626b340f288, put_in_cache=put_in_cache@entry=true) at /test/10.8_dbg/sql/sql_connect.cc:1418
#11 0x00005626af1e6fd1 in handle_one_connection (arg=arg@entry=0x5626b340f288) at /test/10.8_dbg/sql/sql_connect.cc:1312
#12 0x00005626af6689a2 in pfs_spawn_thread (arg=0x5626b3322d28) at /test/10.8_dbg/storage/perfschema/pfs.cc:2201
#13 0x0000147bf29b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#14 0x0000147bf25a7293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

10.5.14 c5b466bcf00fd3eeb1ac9a8664ee3558001f43fb (Debug)

10.5.14-dbg>START TRANSACTION WITH CONSISTENT SNAPSHOT,READ ONLY;
ERROR 2013 (HY000): Lost connection to MySQL server during query

10.5.14 c5b466bcf00fd3eeb1ac9a8664ee3558001f43fb (Debug)

mysqld: /test/bb-10.5-MDEV-27240_dbg/sql/handler.cc:1572: int ha_commit_trans(THD*, bool): Assertion `thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt' failed.

10.5.14 c5b466bcf00fd3eeb1ac9a8664ee3558001f43fb (Debug)

Core was generated by `/test/MDEV-27106-MD170122-mariadb-10.5.14-linux-x86_64-dbg/bin/mysqld --no-defa'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
[Current thread is 1 (Thread 0x14d8645d3700 (LWP 3285360))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x000014d86da59859 in __GI_abort () at abort.c:79
#2  0x000014d86da59729 in __assert_fail_base (fmt=0x14d86dbef588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55f38fb92298 "thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt", file=0x55f38fb91a30 "/test/bb-10.5-MDEV-27240_dbg/sql/handler.cc", line=1572, function=<optimized out>) at assert.c:92
#3  0x000014d86da6af36 in __GI___assert_fail (assertion=assertion@entry=0x55f38fb92298 "thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt", file=file@entry=0x55f38fb91a30 "/test/bb-10.5-MDEV-27240_dbg/sql/handler.cc", line=line@entry=1572, function=function@entry=0x55f38fb94768 "int ha_commit_trans(THD*, bool)") at assert.c:101
#4  0x000055f38efd12f5 in ha_commit_trans (thd=thd@entry=0x14d7cc000db8, all=all@entry=true) at /test/bb-10.5-MDEV-27240_dbg/sql/handler.cc:1572
#5  0x000055f38ee5fa29 in trans_begin (thd=thd@entry=0x14d7cc000db8, flags=3) at /test/bb-10.5-MDEV-27240_dbg/sql/transaction.cc:127
#6  0x000055f38ecf3078 in mysql_execute_command (thd=thd@entry=0x14d7cc000db8) at /test/bb-10.5-MDEV-27240_dbg/sql/sql_parse.cc:5658
#7  0x000055f38ecd9bce in mysql_parse (thd=thd@entry=0x14d7cc000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14d8645d23d0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/bb-10.5-MDEV-27240_dbg/sql/sql_parse.cc:8100
#8  0x000055f38ece9421 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14d7cc000db8, packet=packet@entry=0x14d7cc00b4a9 "START TRANSACTION WITH CONSISTENT SNAPSHOT,READ ONLY", packet_length=packet_length@entry=52, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/bb-10.5-MDEV-27240_dbg/sql/sql_class.h:1290
#9  0x000055f38ececc9d in do_command (thd=0x14d7cc000db8) at /test/bb-10.5-MDEV-27240_dbg/sql/sql_parse.cc:1370
#10 0x000055f38ee4a082 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55f39234c638, put_in_cache=put_in_cache@entry=true) at /test/bb-10.5-MDEV-27240_dbg/sql/sql_connect.cc:1418
#11 0x000055f38ee4a785 in handle_one_connection (arg=arg@entry=0x55f39234c638) at /test/bb-10.5-MDEV-27240_dbg/sql/sql_connect.cc:1312
#12 0x000055f38f306f6f in pfs_spawn_thread (arg=0x55f3922961a8) at /test/bb-10.5-MDEV-27240_dbg/storage/perfschema/pfs.cc:2201
#13 0x000014d86df68609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#14 0x000014d86db56293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.5.14 (dbg), 10.6.6 (dbg), 10.6.6 (opt), 10.7.2 (dbg), 10.7.2 (opt), 10.8.0 (dbg), 10.8.0 (opt)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.42 (dbg), 10.2.42 (opt), 10.3.33 (dbg), 10.3.33 (opt), 10.4.23 (dbg), 10.4.23 (opt), 10.5.14 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.36 (dbg), 5.7.36 (opt), 8.0.27 (dbg), 8.0.27 (opt)



 Comments   
Comment by Nayuta Yanagisawa (Inactive) [ 2022-01-20 ]

I confirmed that the present bug is not reproducible on bb-10.5-MDEV-27239.

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