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

Dead loop in Mariadb version of mysql

Details

    Description

      With the following SQL queries, mysql gets stuck in MariaDB-server but not in MySQL-server and the CPU is occupied 100 %.

      CREATE TEMPORARY TABLE v0 ( v1 INT UNIQUE ) ;
      WITH RECURSIVE v0 ( v1 ) AS ( SELECT -128 UNION SELECT v1 + 33 FROM v0 ) SELECT 'x' , -1 , 54703121.000000 FROM v0 AS v3 , v0 AS v2 ,v0 NATURAL JOIN v0 AS v5 NATURAL JOIN v0 AS v4 ;
      

      Attachments

        Activity

          Do you expect v0 inside the CTE definition to refer to the temporary table? If so, why do you expect that, is it somehow specified by standard?
          I think what it's actually doing is this (no table creation is required):

          WITH RECURSIVE vx ( v1 ) AS ( SELECT -128 UNION SELECT v1 + 33 FROM vx ) select * from vx;
          

          So, it runs until max_recursive_iterations is exceeded, which is 4294967295 by default in MariaDB.

          Which version of MySQL did you try and what does it return? 8.0.18 crashes for me while trying to execute it (a debug build, at least).

          elenst Elena Stepanova added a comment - Do you expect v0 inside the CTE definition to refer to the temporary table? If so, why do you expect that, is it somehow specified by standard? I think what it's actually doing is this (no table creation is required): WITH RECURSIVE vx ( v1 ) AS ( SELECT -128 UNION SELECT v1 + 33 FROM vx ) select * from vx; So, it runs until max_recursive_iterations is exceeded, which is 4294967295 by default in MariaDB. Which version of MySQL did you try and what does it return? 8.0.18 crashes for me while trying to execute it (a debug build, at least).

          People

            Unassigned Unassigned
            YonghengChen Yongheng Chen
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.