[MDEV-31979] Assertion `!internal' failed in void trx_t::free() Created: 2023-08-22  Updated: 2023-08-22

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.4
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Ramesh Sivaraman Assignee: Marko Mäkelä
Resolution: Unresolved Votes: 0
Labels: need_rr, not-10.6

Issue Links:
Relates
relates to MDEV-15020 Server hangs due to InnoDB persistent... Closed
relates to MDEV-25919 InnoDB reports misleading lock wait t... Closed

 Description   

The crash is reproduced only sporadically

# mysqld options required for replay:  --maximum-transaction_prealloc_size=1M --log-output=none --sql_mode= --maximum-range_alloc_block_size=1M --maximum-read_buffer_size=1M
CREATE TABLE t1 (f INT);
INSERT INTO t1 VALUES (1),(4);
CREATE TABLE t (a CHAR(1),FULLTEXT (a));
INSERT INTO t VALUES (1),('Фыва'),('фЫва'),('фыВа'),('фывА'),('ФЫВА');
SET @start_global_value=@@GLOBAL.sql_select_limit;
SET GLOBAL innodb_checksum_algorithm='strict_none';
ALTER TABLE t ADD KEY3 INT,ADD INDEX i3 (KEY3);
ALTER TABLE t ADD COLUMN b INT;
INSERT INTO t VALUES (1,1);
DROP TABLE t;
CREATE TABLE t3 (a INT,b tinyINT);
SET GLOBAL innodb_lru_scan_depth=@start_global_value;
CREATE TABLE t (a INT,b BIT(2));
INSERT INTO t (a) VALUES (2);
CREATE TABLE t5 (c INT);
INSERT INTO t (a) VALUES (1),(7),(9);
SELECT SLEEP (10);
SELECT SLEEP (3);

Leads to

10.4.31 161ce045a71e306768d4609bdc35788fa5ea2a71 (Debug)

mariadbd: /test/10.4_dbg/storage/innobase/trx/trx0trx.cc:392: void trx_t::free(): Assertion `!internal' failed.

10.4.31 161ce045a71e306768d4609bdc35788fa5ea2a71 (Debug)

Core was generated by `/test/MD090823-mariadb-10.4.31-linux-x86_64-dbg/bin/mariadbd --no-defaults --co'.
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 0x147af8e01700 (LWP 1361933))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x0000147afb230859 in __GI_abort () at abort.c:79
#2  0x0000147afb230729 in __assert_fail_base (fmt=0x147afb3c6588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55e53c7dff92 "!internal", file=0x55e53c7debd8 "/test/10.4_dbg/storage/innobase/trx/trx0trx.cc", line=392, function=<optimized out>) at assert.c:92
#3  0x0000147afb241fd6 in __GI___assert_fail (assertion=assertion@entry=0x55e53c7dff92 "!internal", file=file@entry=0x55e53c7debd8 "/test/10.4_dbg/storage/innobase/trx/trx0trx.cc", line=line@entry=392, function=function@entry=0x55e53c7dff68 "void trx_t::free()") at assert.c:101
#4  0x000055e53c1b417c in trx_t::free (this=this@entry=0x147af9161208) at /test/10.4_dbg/storage/innobase/trx/trx0trx.cc:392
#5  0x000055e53c2e78d4 in dict_stats_save (table_orig=table_orig@entry=0x147a9c099040, only_for_index=only_for_index@entry=0x0) at /test/10.4_dbg/storage/innobase/dict/dict0stats.cc:2627
#6  0x000055e53c2ebe7d in dict_stats_update (table=table@entry=0x147a9c099040, stats_upd_option=stats_upd_option@entry=DICT_STATS_RECALC_PERSISTENT) at /test/10.4_dbg/storage/innobase/dict/dict0stats.cc:3234
#7  0x000055e53c2ef959 in dict_stats_process_entry_from_recalc_pool () at /test/10.4_dbg/storage/innobase/dict/dict0stats_bg.cc:431
#8  dict_stats_thread () at /test/10.4_dbg/storage/innobase/dict/dict0stats_bg.cc:515
#9  0x0000147afb741609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#10 0x0000147afb32d133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.4.31 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.4.31 (opt), 10.5.22 (dbg), 10.5.22 (opt), 10.6.15 (opt), 10.6.15 (dbg), 10.9.8 (dbg), 10.9.8 (opt), 10.10.6 (dbg), 10.10.6 (opt), 10.11.5 (dbg), 10.11.5 (opt), 11.0.3 (dbg), 11.0.3 (opt), 11.1.2 (dbg), 11.1.2 (opt), 11.2.0 (dbg), 11.2.0 (opt)



 Comments   
Comment by Marko Mäkelä [ 2023-08-22 ]

The field trx_t::internal was removed in MDEV-25919 (MariaDB Server 10.6). This is somehow related to InnoDB persistent statistics. In a core dump that I checked, dict_stats_save() was being invoked on the table t. This code is known to be buggy before MariaDB Server 10.6; see MDEV-15020.

For mtr testing, it is good to remember that in MDEV-4750, InnoDB persistent statistics were disabled by default, between MariaDB Server 10.0 and 10.5.

I would like to see an rr replay trace that leads to the failure.

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