Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-34678

pthread_mutex_init() without pthread_mutex_destroy() if SUX_LOCK_GENERIC

    XMLWordPrintable

Details

    Description

      To better catch platform-specific bugs such as MDEV-34422, per the suggestion of debarun, I implemented some debug instrumentation for the pthread_mutex_wrapper. This revealed a few places where an init() member function was invoked without a prior destroy().

      For the futex-based implementations of srw_mutex, srw_lock, and sux_lock, this is not an issue, because init() on those data structures simply asserts that the contents is zero-initialized.

      On systems that lack a futex-like system call (systems other than Linux, Microsoft Windows, or those served by MDEV-26476) and where 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. This could affect buf_page_t::lock, dict_index_t::lock (in a special case of ALTER TABLE...IMPORT TABLESPACE), and trx_rseg_t::latch (when innodb_undo_tablespaces is being changed; MDEV-19229).

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.