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

SLEEP() inside complex SELECT hangs indefinitely

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 5.5.33
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      VMware Workstation, Fedora Core 19 vanilla install
      mysql Ver 15.1 Distrib 5.5.32-MariaDB, for Linux (x86_64) using readline 5.1

      Description

      SELECT SLEEP(4), ID FROM Region;
      

      The above statement hangs indefinitely instead of 4 seconds like intended.
      EXPLAIN also doesn't show too much information.

      EXPLAIN SELECT SLEEP(4), ID FROM Region;
      +------+-------------+--------+-------+---------------+---------+---------+------+------+-------------+
      | id   | select_type | table  | type  | possible_keys | key     | key_len | ref  | rows | Extra       |
      +------+-------------+--------+-------+---------------+---------+---------+------+------+-------------+
      |    1 | SIMPLE      | Region | index | NULL          | PRIMARY | 4       | NULL |    1 | Using index |
      +------+-------------+--------+-------+---------------+---------+---------+------+------+-------------+
      
      SHOW CREATE TABLE Region output:
      
      CREATE TABLE `Region` (
        `ID` int(11) NOT NULL AUTO_INCREMENT,
        `Name` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
        PRIMARY KEY (`ID`)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
      

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            elenst Elena Stepanova added a comment -

            Hi,

            Do you mean that it hangs on an empty table?
            Could you please run SHOW FULL PROCESSLIST from a different connection while the query hangs?
            Thanks.

            Show
            elenst Elena Stepanova added a comment - Hi, Do you mean that it hangs on an empty table? Could you please run SHOW FULL PROCESSLIST from a different connection while the query hangs? Thanks.
            Hide
            mov_ebpesp Dorian added a comment -

            Hi,

            I tried both empty and non-empty tables and views. They all hang.

            I'll run that later tonight, but I'm sure you can also reproduce it.

            -Dorian

            Sent from my iPhone

            Show
            mov_ebpesp Dorian added a comment - Hi, I tried both empty and non-empty tables and views. They all hang. I'll run that later tonight, but I'm sure you can also reproduce it. -Dorian Sent from my iPhone
            Hide
            elenst Elena Stepanova added a comment -

            Actually I can't, that's why I'm asking. It looks pretty consistent to me, SELECT on an empty table returns immediately, on a 1-row table it takes 4 sec, on 2-row table it takes 8 sec, etc.

            MariaDB [test]> select count from Region;
            ----------

            count

            ----------

            0

            ----------
            1 row in set (0.00 sec)

            MariaDB [test]> SELECT SLEEP(4), ID FROM Region;
            Empty set (0.01 sec)

            MariaDB [test]> insert into Region (Name) Values ('Region1');
            Query OK, 1 row affected (0.03 sec)

            MariaDB [test]> SELECT SLEEP(4), ID FROM Region;
            ------------+

            SLEEP(4) ID

            ------------+

            0 3

            ------------+
            1 row in set (4.01 sec)

            MariaDB [test]> insert into Region (Name) Values ('Region2');
            Query OK, 1 row affected (0.04 sec)

            MariaDB [test]> SELECT SLEEP(4), ID FROM Region;
            ------------+

            SLEEP(4) ID

            ------------+

            0 3
            0 4

            ------------+
            2 rows in set (8.00 sec)

            MariaDB [test]> show create table Region;
            ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

            Table Create Table

            ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

            Region CREATE TABLE `Region` (
            `ID` int(11) NOT NULL AUTO_INCREMENT,
            `Name` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
            PRIMARY KEY (`ID`)
            ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

            ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
            1 row in set (0.01 sec)

            Show
            elenst Elena Stepanova added a comment - Actually I can't, that's why I'm asking. It looks pretty consistent to me, SELECT on an empty table returns immediately, on a 1-row table it takes 4 sec, on 2-row table it takes 8 sec, etc. MariaDB [test] > select count from Region; ---------- count ---------- 0 ---------- 1 row in set (0.00 sec) MariaDB [test] > SELECT SLEEP(4), ID FROM Region; Empty set (0.01 sec) MariaDB [test] > insert into Region (Name) Values ('Region1'); Query OK, 1 row affected (0.03 sec) MariaDB [test] > SELECT SLEEP(4), ID FROM Region; --------- ---+ SLEEP(4) ID --------- ---+ 0 3 --------- ---+ 1 row in set (4.01 sec) MariaDB [test] > insert into Region (Name) Values ('Region2'); Query OK, 1 row affected (0.04 sec) MariaDB [test] > SELECT SLEEP(4), ID FROM Region; --------- ---+ SLEEP(4) ID --------- ---+ 0 3 0 4 --------- ---+ 2 rows in set (8.00 sec) MariaDB [test] > show create table Region; ------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Table Create Table ------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Region CREATE TABLE `Region` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `Name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.01 sec)
            Hide
            elenst Elena Stepanova added a comment -

            Closing for now according to the previous comment. If you have more information, please comment to re-open the bug.

            Show
            elenst Elena Stepanova added a comment - Closing for now according to the previous comment. If you have more information, please comment to re-open the bug.

              People

              • Assignee:
                elenst Elena Stepanova
                Reporter:
                mov_ebpesp Dorian
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: