[MDEV-12188] information schema - errors populating fail to free memory, unlock mutexes Created: 2017-03-07  Updated: 2018-05-24  Resolved: 2017-05-15

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB, Storage Engine - XtraDB
Affects Version/s: 10.0, 10.1, 10.2
Fix Version/s: 10.1.24, 10.0.31, 10.2.7

Type: Bug Priority: Major
Reporter: Daniel Black Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: information_schema, innodb

Issue Links:
Problem/Incident
causes MDEV-16267 Wrong INFORMATION_SCHEMA.INNODB_BUFFE... Closed

 Description   

Given the OK macro used in innodb does a DBUG_RETURN(1) on expression failure the innodb implementation has a number of errors in i_s.cc

In the case of the OK expression failing:

  1. i_s_innodb_buf_page_lru_fill - heap isn't freed
  2. i_s_innodb_buffer_page_fill - deepest index loop - dict_sys->mutex isn't unlocked
  3. i_s_fts_config_fill - fails to close table, unlock dict_operation_lock and possibly clean up trx
  4. i_s_fts_index_cache_fill_one_index fails to free conv_str.f_str
  5. i_s_fts_deleted_generic_fill fails to free deleted, close table, unlock dict_operation_lock and possibly clean up trx

sync/sync0arr.cc appears safe in its OK usage (from 10.1 onwards)

In addition to the requirement for this fix, perhaps something like
(10.2)

diff --git a/storage/innobase/handler/i_s.h b/storage/innobase/handler/i_s.h
index 8d34fbf..8e455c4 100644
--- a/storage/innobase/handler/i_s.h
+++ b/storage/innobase/handler/i_s.h
@@ -70,6 +70,8 @@ extern struct st_maria_plugin i_s_innodb_sys_semaphore_waits;
 
 #define OK(expr)               \
        if ((expr) != 0) {      \
+               ib::error() << "Error populating innodb information schema with " \
+                           << #expr; \
                DBUG_RETURN(1); \
        }

10.0,10.2 are still using fprintf(stderr.



 Comments   
Comment by Marko Mäkelä [ 2017-05-15 ]

I think that I found some correctness problems in the patch that serg came up with.
I am working on a revised patch, which is introducing another macro BREAK_IF(expr) as an alternative to OK(expr).

Comment by Marko Mäkelä [ 2017-05-15 ]

bb-10.0-marko

Comment by Jan Lindström (Inactive) [ 2017-05-15 ]

I do not see anything really broken, check that one memory allocation where I had question about release. ok to push.

Comment by Marko Mäkelä [ 2017-05-15 ]

In the final version, I simplified the code a little.
It turns out that i_s_innodb_buf_page_lru_fill() was allocating a mem_heap_t for nothing, ever since a change in MariaDB 10.0.4.

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