Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-4728

Query with unusual use of aggregate functions on ColumnStore table crashes MariaDB Server

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.5.1
    • 6.2.1, 6.2.2
    • None
    • 2021-10, 2021-11

    Description

      A query was discovered that can kill the MariaDB process:

      MariaDB [nn]> alter table t engine='innodb';
      Query OK, 0 rows affected (0.118 sec)
      Records: 0  Duplicates: 0  Warnings: 0
       
      MariaDB [nn]> SELECT sum(0+0)-sum(0+0) from t;
      +-------------------+
      | sum(0+0)-sum(0+0) |
      +-------------------+
      |              NULL |
      +-------------------+
      1 row in set (0.000 sec)
       
      MariaDB [nn]> alter table t engine='columnstore';
      Query OK, 0 rows affected (0.094 sec)
      Records: 0  Duplicates: 0  Warnings: 0
       
      MariaDB [nn]> SELECT sum(0+0)-sum(0+0) from t;
      ERROR 2013 (HY000): Lost connection to MySQL server during query
      MariaDB [nn]>
       
      Here are some variations on the same query:
      MariaDB [nn]> select sum(null) from t;
      +-----------+
      | sum(null) |
      +-----------+
      |      NULL |
      +-----------+
      1 row in set (0.042 sec)
       
      MariaDB [nn]> select sum(null)-sum(null) from t;
      ERROR 2013 (HY000): Lost connection to MySQL server during query
       
      MariaDB [nn]> select avg(null)-avg(null) from t;
      ERROR 2013 (HY000): Lost connection to MySQL server during query
      

      Looking in the mariadb.err file:

      210518 12:38:21 [ERROR] mysqld got signal 11 ;
      This could be because you hit a bug. It is also possible that this binary
      ...
      

      Attachments

        Activity

          edward Edward Stoever created issue -
          edward Edward Stoever made changes -
          Field Original Value New Value
          Description A query was discovered that can kill the MariaDB process:
          {{monospaced text}}
          MariaDB [nn]> alter table t engine='innodb';
          Query OK, 0 rows affected (0.118 sec)
          Records: 0 Duplicates: 0 Warnings: 0

          MariaDB [nn]> SELECT sum(0+0)-sum(0+0) from t;
          +-------------------+
          | sum(0+0)-sum(0+0) |
          +-------------------+
          | NULL |
          +-------------------+
          1 row in set (0.000 sec)

          MariaDB [nn]> alter table t engine='columnstore';
          Query OK, 0 rows affected (0.094 sec)
          Records: 0 Duplicates: 0 Warnings: 0

          MariaDB [nn]> SELECT sum(0+0)-sum(0+0) from t;
          ERROR 2013 (HY000): Lost connection to MySQL server during query
          MariaDB [nn]>

          Here are some variations on the same query:
          MariaDB [nn]> select sum(null) from t;
          +-----------+
          | sum(null) |
          +-----------+
          | NULL |
          +-----------+
          1 row in set (0.042 sec)

          MariaDB [nn]> select sum(null)-sum(null) from t;
          ERROR 2013 (HY000): Lost connection to MySQL server during query

          MariaDB [nn]> select avg(null)-avg(null) from t;
          ERROR 2013 (HY000): Lost connection to MySQL server during query
          {{monospaced text}}
          Looking in the mariadb.err file:
          {{monospaced text}}
          210518 12:38:21 [ERROR] mysqld got signal 11 ;
          This could be because you hit a bug. It is also possible that this binary
          ...
          {{monospaced text}}
          A query was discovered that can kill the MariaDB process:
          {noformat}
          MariaDB [nn]> alter table t engine='innodb';
          Query OK, 0 rows affected (0.118 sec)
          Records: 0 Duplicates: 0 Warnings: 0

          MariaDB [nn]> SELECT sum(0+0)-sum(0+0) from t;
          +-------------------+
          | sum(0+0)-sum(0+0) |
          +-------------------+
          | NULL |
          +-------------------+
          1 row in set (0.000 sec)

          MariaDB [nn]> alter table t engine='columnstore';
          Query OK, 0 rows affected (0.094 sec)
          Records: 0 Duplicates: 0 Warnings: 0

          MariaDB [nn]> SELECT sum(0+0)-sum(0+0) from t;
          ERROR 2013 (HY000): Lost connection to MySQL server during query
          MariaDB [nn]>

          Here are some variations on the same query:
          MariaDB [nn]> select sum(null) from t;
          +-----------+
          | sum(null) |
          +-----------+
          | NULL |
          +-----------+
          1 row in set (0.042 sec)

          MariaDB [nn]> select sum(null)-sum(null) from t;
          ERROR 2013 (HY000): Lost connection to MySQL server during query

          MariaDB [nn]> select avg(null)-avg(null) from t;
          ERROR 2013 (HY000): Lost connection to MySQL server during query
          {noformat}
          Looking in the mariadb.err file:
          {noformat}
          210518 12:38:21 [ERROR] mysqld got signal 11 ;
          This could be because you hit a bug. It is also possible that this binary
          ...
          {noformat}
          toddstoffel Todd Stoffel (Inactive) made changes -
          Fix Version/s Icebox [ 22302 ]
          toddstoffel Todd Stoffel (Inactive) made changes -
          Rank Ranked higher
          toddstoffel Todd Stoffel (Inactive) made changes -
          Status Open [ 1 ] Confirmed [ 10101 ]
          toddstoffel Todd Stoffel (Inactive) made changes -
          Fix Version/s 6.1.2 [ 26035 ]
          Fix Version/s Icebox [ 22302 ]
          toddstoffel Todd Stoffel (Inactive) made changes -
          Rank Ranked higher
          ccalender Chris Calender (Inactive) made changes -
          Assignee Gregory Dorman [ gdorman ]
          ccalender Chris Calender (Inactive) made changes -
          Assignee Gregory Dorman [ gdorman ] Alexander Barkov [ bar ]

          Reproducible with this script:

          SET columnstore_select_handler=ON;
          DROP TABLE IF EXISTS t1;
          CREATE TABLE t1 (a INT) ENGINE=ColumnStore;
          SELECT SUM(0+0)-SUM(0+0) FROM t1;
          

          It also crashes with the following queries:

          SELECT SUM(0) FROM t1;
          SELECT COUNT(0) FROM t1;
          SELECT MAX(0) FROM t1;
          

          bar Alexander Barkov added a comment - Reproducible with this script: SET columnstore_select_handler= ON ; DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a INT ) ENGINE=ColumnStore; SELECT SUM (0+0)- SUM (0+0) FROM t1; It also crashes with the following queries: SELECT SUM (0) FROM t1; SELECT COUNT (0) FROM t1; SELECT MAX (0) FROM t1;
          bar Alexander Barkov made changes -
          Status Confirmed [ 10101 ] In Progress [ 3 ]

          More observations:

          This query works fine:

          SELECT SUM(1)+1 FROM t1;
          

          This query crashes:

          SELECT SUM(COALESCE(1))+1 FROM t1;
          

          bar Alexander Barkov added a comment - More observations: This query works fine: SELECT SUM (1)+1 FROM t1; This query crashes: SELECT SUM ( COALESCE (1))+1 FROM t1;

          Also crashes with this query:

          SELECT sum(rand(0))+1 FROM t1;
          

          bar Alexander Barkov added a comment - Also crashes with this query: SELECT sum (rand(0))+1 FROM t1;
          bar Alexander Barkov made changes -
          Assignee Alexander Barkov [ bar ] Denis Khalikov [ JIRAUSER48434 ]
          Status In Progress [ 3 ] In Review [ 10002 ]
          gdorman Gregory Dorman (Inactive) made changes -
          Sprint 2021-10 [ 549 ]
          gdorman Gregory Dorman (Inactive) made changes -
          Rank Ranked higher
          denis0x0D Denis Khalikov (Inactive) made changes -
          Status In Review [ 10002 ] In Testing [ 10301 ]
          denis0x0D Denis Khalikov (Inactive) made changes -
          Assignee Denis Khalikov [ JIRAUSER48434 ] Daniel Lee [ dleeyh ]
          gdorman Gregory Dorman (Inactive) made changes -
          Sprint 2021-10 [ 549 ] 2021-10, 2021-11 [ 549, 567 ]

          Build verified: 6.2.1-1 (#3120)

          Verified test cases in the ticket.

          dleeyh Daniel Lee (Inactive) added a comment - Build verified: 6.2.1-1 (#3120) Verified test cases in the ticket.
          dleeyh Daniel Lee (Inactive) made changes -
          Resolution Fixed [ 1 ]
          Status In Testing [ 10301 ] Closed [ 6 ]
          David.Hall David Hall (Inactive) made changes -
          Fix Version/s 6.2.2 [ 27000 ]
          mariadb-jira-automation Jira Automation (IT) made changes -
          Zendesk Related Tickets 115526

          People

            dleeyh Daniel Lee (Inactive)
            edward Edward Stoever
            Votes:
            1 Vote for this issue
            Watchers:
            6 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.