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

Query interruption does not work as expected with sleep() in queries

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.1.13, 5.5, 10.1, 10.2, 10.3, 10.2.19, 10.4, 10.0
    • Fix Version/s: 10.1, 10.2, 10.3, 10.4, 10.0
    • Component/s: Server
    • Labels:
      None

      Description

      KB (https://mariadb.com/kb/en/library/aborting-statements/) says:

      "MariaDB 10.1.1 introduced the max_statement_time system variable. When set to a non-zero value, any queries taking longer than this time in seconds will be aborted."

      Expected result can be illustrated with the following statements (assuming there arte at least 2 rows in mysql.user table):

      MariaDB [(none)]> select sleep(12),version() from mysql.user limit 1;
      +-----------+-----------------+
      | sleep(12) | version()       |
      +-----------+-----------------+
      |         0 | 10.2.19-MariaDB |
      +-----------+-----------------+
      1 row in set (12.00 sec)
       
      MariaDB [(none)]> set statement max_statement_time = 10 for select sleep(12),version() from mysql.user limit 2;
      ERROR 1969 (70100): Query execution was interrupted (max_statement_time exceeded)
      

      But I also get the following somewhat unexpected results:

      MariaDB [(none)]> set statement max_statement_time = 10 for select sleep(12),version() from dual;
      +-----------+-----------------+
      | sleep(12) | version()       |
      +-----------+-----------------+
      |         1 | 10.2.19-MariaDB |
      +-----------+-----------------+
      1 row in set (10.00 sec)
       
      MariaDB [(none)]> set statement max_statement_time = 10 for select sleep(12),version() from mysql.user limit 1;
      +-----------+-----------------+
      | sleep(12) | version()       |
      +-----------+-----------------+
      |         1 | 10.2.19-MariaDB |
      +-----------+-----------------+
      1 row in set (10.00 sec)
      

      The result of 1 for SELECT() above is expected (sleep was interrupted), but as I stated that the entire statement should not take more than 10 seconds to execute, I expect the same error as in case with LIMIT 2 above.

      It seems max_statement_time error is NOT enforced in some code paths.

        Attachments

          Activity

            People

            Assignee:
            serg Sergei Golubchik
            Reporter:
            valerii Valerii Kravchuk
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: