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

MariaDB crash on WITH RECURSIVE UNION ALL (CTE) query

    XMLWordPrintable

Details

    Description

      One of the customers reported that WITH RECURSIVE, UNION ALL query, MariaDB is crashing.

      Actually, when executing this particular CTE query it actually crashes the server, but nothing logs in the error log (stack trace) . But core dump is generated, further gdb output is captured.

      MariaDB [test]> select @@version;
      +-----------------+
      | @@version       |
      +-----------------+
      | 10.4.14-MariaDB |
      +-----------------+
      1 row in set (0.000 sec)
       
      MariaDB [test]> create table foo (a bigint(10) not null auto_increment, b int(5) not null, c bigint(10) default null, primary key (`a`));
      Query OK, 0 rows affected (0.011 sec)
       
      MariaDB [test]> insert into foo values (1,1,12);
      Query OK, 1 row affected (0.003 sec)
       
      MariaDB [test]> WITH RECURSIVE TREE AS ( SELECT a , b , c FROM foo UNION ALL SELECT A.a , A.b , A.c FROM foo AS A INNER JOIN TREE AS B ON A.c = B.a )  SELECT 0 AS b FROM dual UNION ALL SELECT b FROM TREE;
      ERROR 2013 (HY000): Lost connection to MySQL server during query
      MariaDB [test]> exit
      

      [root@localhost ~]# ls -lrth /var/lib/mysql/core.63301
      -rw------- 1 mysql mysql 509M Aug 28 17:48 /var/lib/mysql/core.63301
      [root@localhost ~]# sudo gdb --batch --eval-command="thread apply all bt" 
       
      /usr/sbin/mysqld /var/lib/mysql/core.63301  > mysqld_bt_all_threads.txt
      

      ===============================================================

      Locally, I can reproduce the issue with the above steps.
      Attaching the error logs, gdb output captured for this crash.

      Attachments

        Activity

          People

            igor Igor Babaev
            suresh.ramagiri@mariadb.com suresh ramagiri
            Votes:
            4 Vote for this issue
            Watchers:
            8 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.