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

Assertion `is_last_prefix <= 0' failed at opt_range.cc:15436

    XMLWordPrintable

Details

    Description

      I used my fuzzing tool to test MariaDB and found a transaction-related bug that make the crashes.

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

      Setup the environment
      1) export ASAN_OPTIONS=detect_leaks=0
      2) /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql &
      3) /usr/local/mysql/bin/mysql -uroot -Dtestdb < mysql_bk.sql (attached) # set up the database

      Reproduce bug

      Note: must in READ COMMITTED isolation level

      /usr/local/mysql/bin/mysql -uroot -Dtestdb # set up connection conn_0
      /usr/local/mysql/bin/mysql -uroot -Dtestdb # set up connection conn_1

      conn_0> SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;

      conn_1> SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;

      conn_1> START TRANSACTION;

      conn_0> START TRANSACTION;

      conn_1> delete from t_swbayb;

      conn_0> insert into t_swbayb (wkey, pkey) values (88, 74000);

      conn_1> insert into t_8fjoxb (wkey, pkey, c_yecif) values
      (110, 115000, case when exists (
      select
      ref_0.wkey as c14
      from
      t_swbayb as ref_0
      where (ref_0.pkey > (
      select distinct
      ref_1.wkey as c0
      from
      t_swbayb as ref_1
      ))) then 'vxg_w' else null end
      ); --- This INSERT is blocked

      conn_0> insert into t_swbayb (wkey, pkey, c_ywdp4d) values (90, 83000, 'vyenkd');

      conn_0> COMMIT; --- this COMMIT make the above INSERT in conn_1 crash the MariaDB server

      conn_1> COMMIT;

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

      Attachments

        Issue Links

          Activity

            People

              oleg.smirnov Oleg Smirnov
              Zuming Jiang Zuming Jiang
              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.