[MDEV-29506] Assertion `!table->pos_in_locked_tables' failed in tc_release_table Created: 2022-09-10  Updated: 2022-10-09  Resolved: 2022-10-09

Status: Closed
Project: MariaDB Server
Component/s: Locking, Storage Engine - InnoDB, Storage Engine - Sequence
Affects Version/s: N/A
Fix Version/s: N/A

Type: Bug Priority: Critical
Reporter: Roel Van de Paar Assignee: Sergei Golubchik
Resolution: Cannot Reproduce Votes: 0
Labels: regression

Issue Links:
Problem/Incident
is caused by MDEV-16329 Engine-independent online ALTER TABLE Closed

 Description   

For branch preview-10.10-ddl only, the following SQL:

CREATE TABLE t (a INT) ENGINE=InnoDB;
LOCK TABLES mysql.time_zone READ,t WRITE;
CREATE OR REPLACE TABLE t (b INT) ENGINE=SEQUENCE;

Leads to:

10.10.0 7a41e4fbc62c5e917d9cb4dc045e21c983d4e73f (Debug)

mysqld: /test/preview-10.10-ddl_dbg/sql/table_cache.cc:446: void tc_release_table(TABLE*): Assertion `!table->pos_in_locked_tables' failed.

10.10.0 7a41e4fbc62c5e917d9cb4dc045e21c983d4e73f (Debug)

Core was generated by `/test/MDEV-16329_preview-10.10-ddl_MD270822-mariadb-10.10.0-linux-x86_64-dbg/bi'.
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 0x14c7584ae700 (LWP 1264775))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x000014c771005859 in __GI_abort () at abort.c:79
#2  0x000014c771005729 in __assert_fail_base (fmt=0x14c77119b588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5651c5684aa4 "!table->pos_in_locked_tables", file=0x5651c5684b98 "/test/preview-10.10-ddl_dbg/sql/table_cache.cc", line=446, function=<optimized out>) at assert.c:92
#3  0x000014c771016fd6 in __GI___assert_fail (assertion=assertion@entry=0x5651c5684aa4 "!table->pos_in_locked_tables", file=file@entry=0x5651c5684b98 "/test/preview-10.10-ddl_dbg/sql/table_cache.cc", line=line@entry=446, function=function@entry=0x5651c5684a86 "void tc_release_table(TABLE*)") at assert.c:101
#4  0x00005651c4c8b2aa in tc_release_table (table=table@entry=0x14c71801ddf8) at /test/preview-10.10-ddl_dbg/sql/table_cache.cc:446
#5  0x00005651c49bbf00 in close_thread_table (thd=thd@entry=0x14c718000db8, table_ptr=table_ptr@entry=0x14c718000ea8) at /test/preview-10.10-ddl_dbg/sql/sql_base.cc:999
#6  0x00005651c49bc380 in close_thread_tables (thd=thd@entry=0x14c718000db8) at /test/preview-10.10-ddl_dbg/sql/sql_base.cc:942
#7  0x00005651c49bd84a in Locked_tables_list::unlock_locked_tables (this=this@entry=0x14c718004df0, thd=thd@entry=0x14c718000db8) at /test/preview-10.10-ddl_dbg/sql/sql_base.cc:2551
#8  0x00005651c49de949 in THD::cleanup (this=this@entry=0x14c718000db8) at /test/preview-10.10-ddl_dbg/sql/sql_class.cc:1529
#9  0x00005651c49150c9 in unlink_thd (thd=0x14c718000db8) at /test/preview-10.10-ddl_dbg/sql/mysqld.cc:2751
#10 0x00005651c4bad994 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5651c6dfedb8, put_in_cache=put_in_cache@entry=true) at /test/preview-10.10-ddl_dbg/sql/sql_connect.cc:1429
#11 0x00005651c4badcc3 in handle_one_connection (arg=0x5651c6dfedb8) at /test/preview-10.10-ddl_dbg/sql/sql_connect.cc:1312
#12 0x000014c771516609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#13 0x000014c771102133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95



 Comments   
Comment by Roel Van de Paar [ 2022-09-10 ]

Whilst MDEV-22149 looks suspiciously similar, that bug does not reproduce anymore, and the versions do not match. Also, this bug does not reproduce on any current trunk version.

Comment by Sergei Golubchik [ 2022-10-09 ]

as of c360eadb8c9, no crash, only an error:

ER_CANT_CREATE_TABLE (1005): Can't create table `test`.`t` (errno: 131 "Command not supported by the engine")

which is correct

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