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

double call procedure in one session - hard shutdown the server

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.3.12, 5.5.34, 10.0.7
    • 5.5.35, 10.0.8
    • None
    • None
    • windows 7, 64x
      mysqld 64x

    Description

      This problem exists if in table more than 10 rows
      eg.

      CREATE TABLE  `action` (
        `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
        `create_ts` int(10) unsigned DEFAULT '0',
        PRIMARY KEY (`id`)
      ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
       
      # and my test for this table
      # 1) creating routine
       
      DELIMITER $$
      DROP PROCEDURE IF EXISTS `p` $$
      CREATE PROCEDURE p (IN step TINYINT(1))
      BEGIN
        DECLARE counts INT DEFAULT 0;
        DECLARE cur1 CURSOR FOR
       
        SELECT ct.id
        FROM (SELECT NULL) AS z
        JOIN (
          SELECT id
          FROM `action`
          LIMIT 10
        ) AS ct
        JOIN (SELECT NULL) AS x ON(
          EXISTS(
            SELECT 1
            FROM `action`
            WHERE id=ct.id
            LIMIT 1
          )
        );
       
        IF step=1 THEN
          TRUNCATE action;
          REPEAT
            INSERT INTO `action`
            (create_ts) VALUES
            (UNIX_TIMESTAMP());
       
            SET counts=counts+1;
          UNTIL counts>150 END REPEAT;
       
          SET max_sp_recursion_depth=1;
       
          CALL p(2);
          CALL p(2);
        ELSEIF step=2 THEN
          OPEN cur1; CLOSE cur1;
        END IF;
      END $$
      DELIMITER ;
       
      CALL p(1);

      And as result - Lost connection to MySQL server during query

      Attachments

        Issue Links

          Activity

            scotovod Pavel Tishkin created issue -
            elenst Elena Stepanova made changes -
            Field Original Value New Value
            Description This problem exists if in table more than 10 rows
            eg.
            CREATE TABLE `action` (
              `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
              `create_ts` int(10) unsigned DEFAULT '0',
              PRIMARY KEY (`id`)
            ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
            and my test for this table
            1) creating routine
            DELIMITER $$
            DROP PROCEDURE IF EXISTS `p` $$
            CREATE PROCEDURE p (IN step TINYINT(1))
            BEGIN
              DECLARE counts INT DEFAULT 0;
              DECLARE cur1 CURSOR FOR

              SELECT ct.id
              FROM (SELECT NULL) AS z
              JOIN (
                SELECT id
                FROM `action`
                LIMIT 10
              ) AS ct
              JOIN (SELECT NULL) AS x ON(
                EXISTS(
                  SELECT 1
                  FROM `action`
                  WHERE id=ct.id
                  LIMIT 1
                )
              );

              IF step=1 THEN
                TRUNCATE action;
                REPEAT
                  INSERT INTO `action`
                  (create_ts) VALUES
                  (UNIX_TIMESTAMP());

                  SET counts=counts+1;
                UNTIL counts>150 END REPEAT;

                SET max_sp_recursion_depth=1;

                CALL p(2);
                CALL p(2);
              ELSEIF step=2 THEN
                OPEN cur1; CLOSE cur1;
              END IF;
            END $$
            DELIMITER ;

            2) CALL p(1);

            And as result - Lost connection to MySQL server during query
            This problem exists if in table more than 10 rows
            eg.

            {code:sql}
            CREATE TABLE `action` (
              `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
              `create_ts` int(10) unsigned DEFAULT '0',
              PRIMARY KEY (`id`)
            ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;

            # and my test for this table
            # 1) creating routine

            DELIMITER $$
            DROP PROCEDURE IF EXISTS `p` $$
            CREATE PROCEDURE p (IN step TINYINT(1))
            BEGIN
              DECLARE counts INT DEFAULT 0;
              DECLARE cur1 CURSOR FOR

              SELECT ct.id
              FROM (SELECT NULL) AS z
              JOIN (
                SELECT id
                FROM `action`
                LIMIT 10
              ) AS ct
              JOIN (SELECT NULL) AS x ON(
                EXISTS(
                  SELECT 1
                  FROM `action`
                  WHERE id=ct.id
                  LIMIT 1
                )
              );

              IF step=1 THEN
                TRUNCATE action;
                REPEAT
                  INSERT INTO `action`
                  (create_ts) VALUES
                  (UNIX_TIMESTAMP());

                  SET counts=counts+1;
                UNTIL counts>150 END REPEAT;

                SET max_sp_recursion_depth=1;

                CALL p(2);
                CALL p(2);
              ELSEIF step=2 THEN
                OPEN cur1; CLOSE cur1;
              END IF;
            END $$
            DELIMITER ;
             
            CALL p(1);
            {code}
            And as result - Lost connection to MySQL server during query
            elenst Elena Stepanova made changes -
            Affects Version/s 5.3.12 [ 12000 ]
            Affects Version/s 5.5.34 [ 13700 ]
            elenst Elena Stepanova made changes -
            Fix Version/s 10.0.8 [ 14200 ]
            Fix Version/s 5.5.35 [ 14000 ]
            Fix Version/s 5.3.13 [ 12602 ]
            elenst Elena Stepanova made changes -
            Assignee Oleksandr Byelkin [ sanja ]
            serg Sergei Golubchik made changes -
            Assignee Oleksandr Byelkin [ sanja ] Michael Widenius [ monty ]
            monty Michael Widenius made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            monty Michael Widenius made changes -
            Fix Version/s 5.3.13 [ 12602 ]
            Fix Version/s 10.0.8 [ 14200 ]
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]
            elenst Elena Stepanova made changes -
            Resolution Fixed [ 1 ]
            Status Closed [ 6 ] Reopened [ 4 ]
            elenst Elena Stepanova made changes -
            Fix Version/s 10.0.8 [ 14200 ]
            elenst Elena Stepanova made changes -
            Resolution Fixed [ 1 ]
            Status Reopened [ 4 ] Closed [ 6 ]
            elenst Elena Stepanova made changes -
            serg Sergei Golubchik made changes -
            Workflow defaullt [ 33100 ] MariaDB v2 [ 42820 ]
            ratzpo Rasmus Johansson (Inactive) made changes -
            Workflow MariaDB v2 [ 42820 ] MariaDB v3 [ 62524 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 62524 ] MariaDB v4 [ 147409 ]

            People

              monty Michael Widenius
              scotovod Pavel Tishkin
              Votes:
              0 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.