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

SIGSEGV in query optimizer (in set_check_materialized with MERGE view)

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.3.12, 5.5.33a, 5.5.37, 10.0.11
    • 5.5.38, 10.0.12, 5.3.13
    • None
    • None
    • Ubuntu Precise Pangolin 12.04 LTS 64 bit on hardware (IBM Bladecenter with 48Gb RAM) or virtual machine (VmWare Fusion on MacOS X with 4Gb RAM).

    Description

      SIGSEGV in parsing a query that joins the same VIEW at least 8 times and the VIEW joins a number of tables.

      I have reduced our much more complicated query and tables to the following script that reliably kills MariaDb 5.5.33a-MariaDB-1~precise-log on Ubuntu 12.04 Precise Pangolin 64 bit:

      CREATE DATABASE IF NOT EXISTS test_14390;
      USE test_14390;
       
      DROP TABLE IF EXISTS a;
      DROP TABLE IF EXISTS b;
      DROP TABLE IF EXISTS c;
      DROP TABLE IF EXISTS d;
      DROP TABLE IF EXISTS e;
      DROP TABLE IF EXISTS f;
       
      CREATE TABLE a (a1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
      CREATE TABLE b (b1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
      CREATE TABLE c (c1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
      CREATE TABLE d (d1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
      CREATE TABLE e (e1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
      CREATE TABLE f (f1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
        
      CREATE OR REPLACE view v1 AS
        SELECT 1
        FROM a a_alias_1
          LEFT JOIN (b b_alias_1 JOIN a a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
          LEFT JOIN c c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
          LEFT JOIN d d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
          LEFT JOIN c c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
          LEFT JOIN e e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
          LEFT JOIN f f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
      ;
       
      SELECT 1
      FROM (v1 t1)
      LEFT OUTER JOIN (v1 t2) ON 1=1
      LEFT OUTER JOIN (v1 t3) ON 1=1
      LEFT OUTER JOIN (v1 t4) ON 1=1
      LEFT OUTER JOIN (v1 t5) ON 1=1
      LEFT OUTER JOIN (v1 t6) ON 1=1
      LEFT OUTER JOIN (v1 t7) ON 1=1
      LEFT OUTER JOIN (v1 t8) ON 1=1
      ;

      See attached MariaDb_5_5_33a_log.txt for the resulting error log.

      Similar failures have been seen on MariaDb 5.5.37 and 10.0.11 - see other attached log files. Note that these two have debug symbols which helps to show that the bug seems to be to do with materializing views in the query optimizer.

      We wondered whether the "Optimizer switch" values might affect the behaviour, but we tried turning them all on and off with no effect on the crash.

      The crashes have been observed on large BladeCenter machines with 48Gb of RAM, and reproduced on a VmWare Fusion virtual machine on Mac OS X with 4Gb of RAM. I doubt the hardware or architecture has anything to do with the problem.

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            jonathan.monahan@workbooks.com Jonathan Monahan
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.