mariadb/storage/innobase/buf
Marko Mäkelä 4f8803c036 MDEV-34678 pthread_mutex_init() without pthread_mutex_destroy()
When SUX_LOCK_GENERIC is defined, the srw_mutex, srw_lock, sux_lock are
implemented based on pthread_mutex_t and pthread_cond_t.  This is the
only option for systems that lack a futex-like system call.

In the SUX_LOCK_GENERIC mode, if pthread_mutex_init() is allocating
some resources that need to be freed by pthread_mutex_destroy(),
a memory leak could occur when we are repeatedly invoking
pthread_mutex_init() without a pthread_mutex_destroy() in between.

pthread_mutex_wrapper::initialized: A debug field to track whether
pthread_mutex_init() has been invoked.  This also helps find bugs
like the one that was fixed by
commit 1c8af2ae53 (MDEV-34422);
one simply needs to add -DSUX_LOCK_GENERIC to the CMAKE_CXX_FLAGS
to catch that particular bug on the initial server bootstrap.

buf_block_init(), buf_page_init_for_read(): Invoke block_lock::init()
because buf_page_t::init() will no longer do that.

buf_page_t::init(): Instead of invoking lock.init(), assert that it
has already been invoked (the lock is vacant).

add_fts_index(), build_fts_hidden_table(): Explicitly invoke
index_lock::init() in order to avoid a pthread_mutex_destroy()
invocation on an uninitialized object.

srw_lock_debug::destroy(): Invoke readers_lock.destroy().

trx_sys_t::create(): Invoke trx_rseg_t::init() on all rollback segments
in order to guarantee a deterministic state for shutdown, even if
InnoDB fails to start up.

trx_rseg_array_init(), trx_temp_rseg_create(), trx_rseg_create():
Invoke trx_rseg_t::destroy() before trx_rseg_t::init() in order to
balance pthread_mutex_init() and pthread_mutex_destroy() calls.
2024-08-14 07:54:15 +03:00
..
buf0buddy.cc MDEV-27891: SIGSEGV in InnoDB buffer pool resize 2022-03-07 13:36:18 +11:00
buf0buf.cc MDEV-34678 pthread_mutex_init() without pthread_mutex_destroy() 2024-08-14 07:54:15 +03:00
buf0checksum.cc MDEV-25105 Remove innodb_checksum_algorithm values none,innodb,... 2021-03-11 12:46:18 +02:00
buf0dblwr.cc Merge 10.5 into 10.6 2024-01-17 13:35:05 +02:00
buf0dump.cc Merge branch '10.5' into 10.6 2024-07-16 15:54:22 +08:00
buf0flu.cc MDEV-34265 Possible hang during IO burst with innodb_flush_sync enabled 2024-06-05 18:11:29 +05:30
buf0lru.cc MDEV-34265 Possible hang during IO burst with innodb_flush_sync enabled 2024-06-05 18:11:29 +05:30
buf0rea.cc MDEV-34678 pthread_mutex_init() without pthread_mutex_destroy() 2024-08-14 07:54:15 +03:00