[MDEV-14422] Assertion failure in file storage/innobase/trx/trx0purge.cc upon shutdown Created: 2017-11-16  Updated: 2017-12-13  Resolved: 2017-12-13

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.2
Fix Version/s: 10.2.12, 10.3.3

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: None


 Description   

These sleeps, however crude, help to reproduce the problem (on my machine reliably):

diff --git a/storage/innobase/row/row0quiesce.cc b/storage/innobase/row/row0quiesce.cc
index dd6289c..e75137f 100644
--- a/storage/innobase/row/row0quiesce.cc
+++ b/storage/innobase/row/row0quiesce.cc
@@ -600,6 +600,7 @@ row_quiesce_table_complete(
 
 		os_file_delete_if_exists(innodb_data_file_key, cfg_name, NULL);
 
+    my_sleep(2000000);
 		ib::info() << "Deleting the meta-data file '" << cfg_name << "'";
 	}
 
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index 4e51796..45afd72 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -1783,6 +1783,7 @@ trx_purge_run(void)
 {
 	rw_lock_x_lock(&purge_sys->latch);
 
+  my_sleep(1000000);
 	switch (purge_sys->state) {
 	case PURGE_STATE_INIT:
 	case PURGE_STATE_EXIT:

--source include/have_innodb.inc
CREATE OR REPLACE TABLE t1 (t TIMESTAMP) ENGINE=InnoDB;
FLUSH TABLE t1 FOR EXPORT;
shutdown;

10.2 0e69d0b094365 with the patch above

2017-12-13  3:10:50 139949094012672 [Note] InnoDB: Writing table metadata to './test/t1.cfg'
2017-12-13  3:10:50 139949094012672 [Note] InnoDB: Table `test`.`t1` flushed to disk
2017-12-13  3:10:50 139948960823040 [Note] /data/src/10.2-bug/sql/mysqld (root[root] @ localhost []): Normal shutdown
 
2017-12-13  3:10:50 139948841735936 [Note] InnoDB: FTS optimize thread exiting.
2017-12-13  3:10:50 139948960823040 [Note] Event Scheduler: Purging the queue. 0 events
2017-12-13  3:10:52 139949094012672 [Note] InnoDB: Deleting the meta-data file './test/t1.cfg'
2017-12-13 03:10:53 0x7f4870090700  InnoDB: Assertion failure in file /data/src/10.2-bug/storage/innobase/trx/trx0purge.cc line 1837
InnoDB: We intentionally generate a memory trap.
 
#5  0x00007f4875dbc3fa in abort () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x00005594dd7a7b88 in ut_dbg_assertion_failed (expr=0x0, file=0x5594ddc9a748 "/data/src/10.2-bug/storage/innobase/trx/trx0purge.cc", line=1837) at /data/src/10.2-bug/storage/innobase/ut/ut0dbg.cc:61
#7  0x00005594dd772f30 in trx_purge_run () at /data/src/10.2-bug/storage/innobase/trx/trx0purge.cc:1837
#8  0x00005594dd734762 in row_quiesce_table_complete (table=0x7f4818149778, trx=0x7f486bc000d8) at /data/src/10.2-bug/storage/innobase/row/row0quiesce.cc:608
#9  0x00005594dd5a7aa4 in ha_innobase::external_lock (this=0x7f4818131f88, thd=0x7f4818000b00, lock_type=2) at /data/src/10.2-bug/storage/innobase/handler/ha_innodb.cc:16324
#10 0x00005594dd28ecdc in handler::ha_external_lock (this=0x7f4818131f88, thd=0x7f4818000b00, lock_type=2) at /data/src/10.2-bug/sql/handler.cc:5903
#11 0x00005594dd399776 in unlock_external (thd=0x7f4818000b00, table=0x7f481816d628, count=1) at /data/src/10.2-bug/sql/lock.cc:719
#12 0x00005594dd398c4e in mysql_unlock_tables (thd=0x7f4818000b00, sql_lock=0x7f481816d610, free_lock=true) at /data/src/10.2-bug/sql/lock.cc:429
#13 0x00005594dd398bb9 in mysql_unlock_tables (thd=0x7f4818000b00, sql_lock=0x7f481816d610) at /data/src/10.2-bug/sql/lock.cc:418
#14 0x00005594dcf9c46b in close_thread_tables (thd=0x7f4818000b00) at /data/src/10.2-bug/sql/sql_base.cc:840
#15 0x00005594dcf9edf0 in Locked_tables_list::unlock_locked_tables (this=0x7f4818004510, thd=0x7f4818000b00) at /data/src/10.2-bug/sql/sql_base.cc:2154
#16 0x00005594dcfc61cd in THD::cleanup (this=0x7f4818000b00) at /data/src/10.2-bug/sql/sql_class.cc:1453
#17 0x00005594dcf30b25 in unlink_thd (thd=0x7f4818000b00) at /data/src/10.2-bug/sql/mysqld.cc:2904
#18 0x00005594dcf30fc6 in one_thread_per_connection_end (thd=0x7f4818000b00, put_in_cache=true) at /data/src/10.2-bug/sql/mysqld.cc:3049
#19 0x00005594dd15843a in do_handle_one_connection (connect=0x5594e07220c0) at /data/src/10.2-bug/sql/sql_connect.cc:1373
#20 0x00005594dd1580de in handle_one_connection (arg=0x5594e07220c0) at /data/src/10.2-bug/sql/sql_connect.cc:1260
#21 0x00005594dd576a76 in pfs_spawn_thread (arg=0x5594e072c630) at /data/src/10.2-bug/storage/perfschema/pfs.cc:1863
#22 0x00007f4877a8a494 in start_thread (arg=0x7f4870090700) at pthread_create.c:333
#23 0x00007f4875e7093f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Also reproducible on 10.3.



 Comments   
Comment by Marko Mäkelä [ 2017-12-13 ]

I think that it was also possible for FLUSH TABLES…FOR EXPORT to cause a hang during shutdown. My fix should have addressed that too.

Generated at Thu Feb 08 08:13:25 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.