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

trx_t::lock.was_chosen_as_deadlock_victim race in lock_wait_end()

    XMLWordPrintable

Details

    Description

      I used my fuzzing tool to test Mariadb , and found a transaction-related bug that can result in an abortion.

      Mariadb installation:
      1) cd mariadb-10.8.3
      2) mkdir build; cd build
      3) cmake .. -DCMAKE_BUILD_TYPE=Debug
      4) make -j12 && sudo make install

      Test driver compilation:
      Note: "mariadb_reproduce" sets up several transactions and execute SQL statements according to /tmp/mysql_bk.sql, /tmp/stmts.sql and /tmp/tid.txt
      1) g++ -I/usr/local/mysql/include/ mariadb_reproduce.cc -o mariadb_reproduce -lmysqlclient -g

      Reproduce the bug:
      1) cp mysql_bk.sql /tmp; cp stmts.sql /tmp; cp tid.txt /tmp
      2) export ASAN_OPTIONS=detect_leaks=0
      3) /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql &
      4) bash reproduce.sh # "reproduce.sh" repeatedly executes "mariadb_reproduce" 100 times. "reproduce.sh" and "mariadb_reproduce" should be in the same directory

      I have simplified the content of fuzz.sql, and I hope fuzz.sql can help you reproduce and fix the bug. In addition, I attached the failure report (which has its stack trace).

      This bug seems related to concurrency and it cannot be reproduced stably. However, it did occur and crashed the server in my test. To stably trigger this bug, I use "reproduce.sh" to execute "mariadb_reproduce" 100 times. Hope you could reproduce the bug successfully

      Attachments

        1. tid.txt
          0.1 kB
        2. stmts.sql
          18 kB
        3. reproduce.sh
          0.1 kB
        4. mysql_bk.sql
          7 kB
        5. MDEV-29081.test
          4 kB
        6. mariadb_reproduce.cc
          14 kB
        7. bug_report.txt
          6 kB

        Issue Links

          Activity

            People

              vlad.lesin Vladislav Lesin
              Zuming Jiang Zuming Jiang
              Votes:
              0 Vote for this issue
              Watchers:
              7 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.