[MDEV-27187] SIGSEGV in ha_spider::lock_tables or Assertion: thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt|SIGABRT|ha_commit_trans|trans_begin|mysql_execute_command|mysql_parse failed on starting trx under FTWRL Created: 2021-12-07  Updated: 2022-06-28  Resolved: 2022-06-28

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

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

Issue Links:
Relates

 Description   

INSTALL PLUGIN spider SONAME 'ha_spider.so';
CREATE TABLE t (c1 INT,c2 INT,c3 INT,c4 INT,KEY REFID (c3)) ENGINE=SPIDER;
INSERT INTO t VALUES (5,1);
DELETE FROM d.t;
FLUSH TABLE t WITH READ LOCK;
START TRANSACTION;

Leads to:

10.6.6 e0e24b180d090d7ee378c097ab02df891b61a965 (Optimized)

Core was generated by `/test/MD031221-mariadb-10.6.6-linux-x86_64-opt/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00001462e41514a1 in ha_spider::lock_tables (
    this=this@entry=0x1462ac0484d0)
    at /test/10.6_opt/storage/spider/ha_spider.cc:16410
16410	        if (
[Current thread is 1 (Thread 0x1462f8128700 (LWP 336850))]
(gdb) bt
#0  0x00001462e41514a1 in ha_spider::lock_tables (this=this@entry=0x1462ac0484d0) at /test/10.6_opt/storage/spider/ha_spider.cc:16410
#1  0x00001462e41519b8 in ha_spider::external_lock (this=0x1462ac0484d0, thd=<optimized out>, lock_type=2) at /test/10.6_opt/storage/spider/ha_spider.cc:1350
#2  0x000055b3726973b4 in handler::ha_external_lock (this=0x1462ac0484d0, thd=thd@entry=0x1462ac000c58, lock_type=lock_type@entry=2) at /test/10.6_opt/sql/handler.cc:7045
#3  0x000055b37279853a in handler::ha_external_unlock (thd=0x1462ac000c58, this=<optimized out>) at /test/10.6_opt/sql/handler.h:3590
#4  unlock_external (count=<optimized out>, table=0x1462ac0628c8, thd=0x1462ac000c58) at /test/10.6_opt/sql/lock.cc:727
#5  mysql_unlock_tables (thd=0x1462ac000c58, sql_lock=0x1462ac062898, free_lock=<optimized out>) at /test/10.6_opt/sql/lock.cc:432
#6  0x000055b372798ba8 in mysql_unlock_tables (thd=thd@entry=0x1462ac000c58, sql_lock=<optimized out>) at /test/10.6_opt/sql/lock.cc:415
#7  0x000055b3723e8585 in close_thread_tables (thd=thd@entry=0x1462ac000c58) at /test/10.6_opt/sql/sql_base.cc:913
#8  0x000055b3723e934b in Locked_tables_list::unlock_locked_tables (thd=0x1462ac000c58, this=0x1462ac004c40) at /test/10.6_opt/sql/sql_base.cc:2378
#9  Locked_tables_list::unlock_locked_tables (this=this@entry=0x1462ac004c40, thd=thd@entry=0x1462ac000c58) at /test/10.6_opt/sql/sql_base.cc:2349
#10 0x000055b3725783fc in trans_begin (thd=thd@entry=0x1462ac000c58, flags=0) at /test/10.6_opt/sql/transaction.cc:115
#11 0x000055b37245c1c0 in mysql_execute_command (thd=0x1462ac000c58, is_called_from_prepared_stmt=<optimized out>) at /test/10.6_opt/sql/sql_parse.cc:5599
#12 0x000055b37244a9a6 in mysql_parse (thd=0x1462ac000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /test/10.6_opt/sql/sql_parse.cc:8030
#13 0x000055b372456b65 in dispatch_command (command=COM_QUERY, thd=0x1462ac000c58, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /test/10.6_opt/sql/sql_class.h:1358
#14 0x000055b372458d57 in do_command (thd=0x1462ac000c58, blocking=blocking@entry=true) at /test/10.6_opt/sql/sql_parse.cc:1404
#15 0x000055b372568957 in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /test/10.6_opt/sql/sql_connect.cc:1418
#16 0x000055b372568c9d in handle_one_connection (arg=arg@entry=0x55b375764f68) at /test/10.6_opt/sql/sql_connect.cc:1312
#17 0x000055b3728f4828 in pfs_spawn_thread (arg=0x55b3756d0ec8) at /test/10.6_opt/storage/perfschema/pfs.cc:2201
#18 0x00001462f925e609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#19 0x00001462f8e4c293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

10.6.6 e0e24b180d090d7ee378c097ab02df891b61a965 (Debug)

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

10.6.6 e0e24b180d090d7ee378c097ab02df891b61a965 (Debug)

Core was generated by `/test/MD031221-mariadb-10.6.6-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 0x1531d08c5700 (LWP 376119))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00001531d3282859 in __GI_abort () at abort.c:79
#2  0x00001531d3282729 in __assert_fail_base (fmt=0x1531d3418588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x56144a82d760 "thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt", file=0x56144a82bf33 "/test/10.6_dbg/sql/handler.cc", line=1645, function=<optimized out>) at assert.c:92
#3  0x00001531d3293f36 in __GI___assert_fail (assertion=assertion@entry=0x56144a82d760 "thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt", file=file@entry=0x56144a82bf33 "/test/10.6_dbg/sql/handler.cc", line=line@entry=1645, function=function@entry=0x56144a82fcd0 "int ha_commit_trans(THD*, bool)") at assert.c:101
#4  0x0000561449ccbbea in ha_commit_trans (thd=thd@entry=0x15316c000db8, all=all@entry=true) at /test/10.6_dbg/sql/handler.cc:1645
#5  0x0000561449b45c01 in trans_begin (thd=thd@entry=0x15316c000db8, flags=0) at /test/10.6_dbg/sql/transaction.cc:127
#6  0x00005614499d11df in mysql_execute_command (thd=thd@entry=0x15316c000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.6_dbg/sql/sql_parse.cc:5599
#7  0x00005614499b8dec in mysql_parse (thd=thd@entry=0x15316c000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1531d08c4400) at /test/10.6_dbg/sql/sql_parse.cc:8030
#8  0x00005614499c7ab1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x15316c000db8, packet=packet@entry=0x15316c00b769 "START TRANSACTION", packet_length=packet_length@entry=17, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1358
#9  0x00005614499caeeb in do_command (thd=0x15316c000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1404
#10 0x0000561449b30018 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x56144d374408, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1418
#11 0x0000561449b3061d in handle_one_connection (arg=arg@entry=0x56144d374408) at /test/10.6_dbg/sql/sql_connect.cc:1312
#12 0x0000561449fe1e4e in pfs_spawn_thread (arg=0x56144d2814d8) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
#13 0x00001531d3791609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#14 0x00001531d337f293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.4.23 (dbg), 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 (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-06-28 ]

This is a duplication of MDEV-28352.

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