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

safe_mutex: Found wrong usage of mutex 'log_space_lock' and 'LOCK_log'

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.0.13
    • Fix Version/s: 10.0.14
    • Component/s: None
    • Labels:
      None

      Description

      Our automated testing detected the report from safe_mutex about wrong usage of mutexes. Manual analysis reveals that there are indeed code paths that lock these mutexes in the different order.

      First code path (line numbers are from 10.0.13 tarball):

      sql/slave.cc:6206 (function next_event()) -- locks LOCK_log
      sql/slave.cc:6397 (further in function next_event()) -- locks rli->log_space_lock
      

      Second code path:

      sql/slave.cc:2238 (function wait_for_relay_log_space()) -- locks rli->log_space_lock
      sql/log.cc:4825 (function MYSQL_BIN_LOG::new_file_impl() called from MYSQL_BIN_LOG::new_file() called from rotate_relay_log() called from further in wait_for_relay_log_space()) -- locks LOCK_log
      

      Even if currently it's impossible for these code paths to execute at the same time in parallel please fix them to avoid safe_mutex error message (which actually means that in future some changes may lead to these paths to dead lock).

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            monty Michael Widenius added a comment -

            I moved freeing of log_space_lock earlier to avoid the problem.
            This is safe as we don't need to have log_space_lock locked for calling rotate_relay_log.

            Show
            monty Michael Widenius added a comment - I moved freeing of log_space_lock earlier to avoid the problem. This is safe as we don't need to have log_space_lock locked for calling rotate_relay_log.
            Hide
            monty Michael Widenius added a comment -

            Pushed

            Show
            monty Michael Widenius added a comment - Pushed

              People

              • Assignee:
                monty Michael Widenius
                Reporter:
                pivanof Pavel Ivanov
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours
                  2h