[MDEV-27197] Assertion `thd->transaction->stmt.is_empty() || thd->in_sub_stmt || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)' failed in close_thread_tables Created: 2021-12-08  Updated: 2022-06-28  Resolved: 2022-06-28

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Spider
Affects Version/s: 10.4, 10.5, 10.6, 10.7, 10.8
Fix Version/s: 10.4.26, 10.5.17, 10.6.9, 10.7.5, 10.8.4, 10.9.2

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

Issue Links:
Relates

 Description   

Does not look related to MDEV-27185.

INSTALL PLUGIN spider SONAME 'ha_spider.so';
CREATE TABLE t (a INT) ENGINE=SPIDER;
CREATE TRIGGER i AFTER INSERT ON t FOR EACH ROW CALL p();
INSERT DELAYED INTO t VALUES (0);

Leads to:

10.6.6 e0e24b180d090d7ee378c097ab02df891b61a965 (Debug)

mysqld: /test/10.6_dbg/sql/sql_base.cc:801: int close_thread_tables(THD*): Assertion `thd->transaction->stmt.is_empty() || thd->in_sub_stmt || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)' 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 0x151a2c0c1700 (LWP 999853))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x0000151a41dab859 in __GI_abort () at abort.c:79
#2  0x0000151a41dab729 in __assert_fail_base (fmt=0x151a41f41588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5639d5285e30 "thd->transaction->stmt.is_empty() || thd->in_sub_stmt || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)", file=0x5639d52856e0 "/test/10.6_dbg/sql/sql_base.cc", line=801, function=<optimized out>) at assert.c:92
#3  0x0000151a41dbcf36 in __GI___assert_fail (assertion=assertion@entry=0x5639d5285e30 "thd->transaction->stmt.is_empty() || thd->in_sub_stmt || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)", file=file@entry=0x5639d52856e0 "/test/10.6_dbg/sql/sql_base.cc", line=line@entry=801, function=function@entry=0x5639d52881b1 "int close_thread_tables(THD*)") at assert.c:101
#4  0x00005639d4537f6f in close_thread_tables (thd=0x1519f40cfb78) at /test/10.6_dbg/sql/handler.h:1948
#5  0x00005639d45849bc in handle_delayed_insert (arg=arg@entry=0x1519f40cfb58) at /test/10.6_dbg/sql/sql_insert.cc:3389
#6  0x00005639d4be5e4e in pfs_spawn_thread (arg=0x5639d7b3d4d8) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
#7  0x0000151a422ba609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#8  0x0000151a41ea8293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

10.4.23 94ef277b5b98afb25400fdb1b3b4917ef16172da (Debug)

mysqld: /test/10.4_dbg/sql/sql_base.cc:897: void close_thread_tables(THD*): Assertion `thd->transaction.stmt.is_empty() || thd->in_sub_stmt || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)' failed.

10.4.23 94ef277b5b98afb25400fdb1b3b4917ef16172da (Debug)

Core was generated by `/test/MD121121-mariadb-10.4.23-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 0x14dcbc06a700 (LWP 1073051))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x000014dcbd4bc859 in __GI_abort () at abort.c:79
#2  0x000014dcbd4bc729 in __assert_fail_base (fmt=0x14dcbd652588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x556574e76360 "thd->transaction.stmt.is_empty() || thd->in_sub_stmt || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)", file=0x556574e75c10 "/test/10.4_dbg/sql/sql_base.cc", line=897, function=<optimized out>) at assert.c:92
#3  0x000014dcbd4cdf36 in __GI___assert_fail (assertion=assertion@entry=0x556574e76360 "thd->transaction.stmt.is_empty() || thd->in_sub_stmt || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)", file=file@entry=0x556574e75c10 "/test/10.4_dbg/sql/sql_base.cc", line=line@entry=897, function=function@entry=0x556574e76340 "void close_thread_tables(THD*)") at assert.c:101
#4  0x0000556574129aa8 in close_thread_tables (thd=0x14dc5c0d6f10) at /test/10.4_dbg/sql/handler.h:1780
#5  0x0000556574177c37 in handle_delayed_insert (arg=0x14dc5c0d6ef0) at /test/10.4_dbg/sql/sql_insert.cc:3276
#6  0x000014dcbd9cb609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#7  0x000014dcbd5b9293 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.7.2 (dbg), 10.8.0 (dbg)

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), 10.6.6 (opt), 10.7.2 (opt), 10.8.0 (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 ]

INSERT DELAYED is no longer allowed on Spider tables because of MDEV-28854.

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