[MDEV-23927] Crash in ./mtr --skip-innodb-fast-shutdown innodb.temporary_tables Created: 2020-10-09  Updated: 2020-10-09  Resolved: 2020-10-09

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.5.0
Fix Version/s: 10.5.7

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: crash, regression, shutdown

Issue Links:
Problem/Incident
is caused by MDEV-16264 Implement a common work queue for Inn... Closed

 Description   

The following test would crash the server as follows:

./mtr --mysqld=--skip-innodb-fast-shutdown innodb.temporary_table

10.5 d312d64146b1858e3fc6cc2f365cbc795b0b067e

innodb.temporary_table 'innodb'          [ fail ]
        Test ended at 2020-10-09 12:35:53
 
CURRENT_TEST: innodb.temporary_table
 
 
Server [mysqld.1 - pid: 1837431, winpid: 1837431, exit: 256] failed during test run
Server log from this test:
2020-10-09 12:35:52 0 [Note] mariadbd: O_TMPFILE is not supported on /dev/null/nonexistent (disabling future attempts)
2020-10-09 12:35:52 0 [ERROR] mariadbd: Can't create/write to file '/dev/null/nonexistent/ibfxyqA9' (Errcode: 20 "Not a directory")
2020-10-09 12:35:52 0 [ERROR] InnoDB: Unable to create temporary file; errno: 20
2020-10-09 12:35:52 0 [ERROR] mariadbd: Can't create/write to file '/dev/null/nonexistent/ibieeQKc' (Errcode: 20 "Not a directory")
2020-10-09 12:35:52 0 [ERROR] InnoDB: Unable to create temporary file; errno: 20
2020-10-09 12:35:52 0 [ERROR] InnoDB: Plugin initialization aborted at srv0start.cc[1279] with error Generic error
mariadbd: /mariadb/10.5/storage/innobase/include/sync0types.h:414: void OSMutex::enter(): Assertion `!m_freed' failed.

The fix is simple, and this scenario only affects slow shutdown after a failed startup:

diff --git a/mysql-test/suite/innodb/t/temporary_table.test b/mysql-test/suite/innodb/t/temporary_table.test
index 8e3ddf95634..389e106a345 100644
--- a/mysql-test/suite/innodb/t/temporary_table.test
+++ b/mysql-test/suite/innodb/t/temporary_table.test
@@ -131,7 +131,7 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
 # We cannot use include/restart_mysqld.inc in this particular test,
 # because SHOW STATUS would fail due to unwritable (nonexistent) tmpdir.
 --source include/shutdown_mysqld.inc
---exec echo "restart: --tmpdir=/dev/null/nonexistent" > $_expect_file_name
+--exec echo "restart: --tmpdir=/dev/null/nonexistent --skip-innodb-fast-shutdown" > $_expect_file_name
 --enable_reconnect
 --disable_result_log
 --disable_query_log
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 3481df9160b..59ed743b087 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -2076,8 +2076,9 @@ void innodb_preshutdown()
     better prevent any further changes from being buffered. */
     innodb_change_buffering= 0;
 
-    while (trx_sys.any_active_transactions())
-      os_thread_sleep(1000);
+    if (trx_sys.is_initialised())
+      while (trx_sys.any_active_transactions())
+        os_thread_sleep(1000);
   }
   srv_shutdown_bg_undo_sources();
   srv_purge_shutdown();


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