[MDEV-20675] Crash in SHOW ENGINE INNODB STATUS with innodb_force_recovery=5 Created: 2019-09-26  Updated: 2019-09-26  Resolved: 2019-09-26

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.3.15, 10.4.5
Fix Version/s: 10.3.19, 10.4.9

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

Issue Links:
Problem/Incident
is caused by MDEV-18429 Consistent non-locking reads do not a... Closed

 Description   

The following test crashes the server:

--source include/have_innodb.inc
--let $restart_parameters= --innodb-force-recovery=5
--source include/restart_mysqld.inc
SHOW ENGINE INNODB STATUS;

In innodb_force_recovery=5 mode, no undo logs will be parsed, and purge_sys will not be initialized. The fix is simple:

--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -4689,7 +4689,8 @@ struct lock_print_info
   void operator()(const trx_t* trx) const
   {
     ut_ad(mutex_own(&trx_sys.mutex));
-    if (trx == purge_sys.query->trx)
+    if (UNIV_LIKELY(purge_sys.query != NULL) &&
+        UNIV_UNLIKELY(trx == purge_sys.query->trx))
       return;
     lock_trx_print_wait_and_mvcc_state(file, trx, now);
 

The crash was introduced by the merge of MDEV-18429 from 10.2. 10.2 itself is not affected.


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