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

Multiple calls to a Stored Procedure from another Stored Procedure crashes server

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 10.4.13, 10.5.4
    • 10.4.16, 10.5.7
    • Parser
    • Win64 (Windows Server 2019)

    Description

      Multiple calls to a Stored Procedure (e.g. from a loop) from another Stored Procedure crashes the database server (i.e. the MariaDB Windows Service stops running). The crash seems to occure on the second call to the inner Stored Procedure.

      This problem has been present in the latest releases of 10.4, and also in the new 10.5.4 .
      MariaDB 10.3 is Ok though.

      //Code Example
      CREATE PROCEDURE SP1
      BEGIN
        DECLARE p INT
       
        SET P = 2;
        WHILE ( p > 0 ) DO
          CALL SP2;
          SET P = P - 1;
        END WHILE;
      END
      

      Attachments

        Issue Links

          Activity

            ommit 1b61b41d6aaffebedbad330a84b5196091724956 (HEAD > bb-10.4MDEV-23094, 10.4)
            Author: Oleksandr Byelkin <sanja@mariadb.com>
            Date: Tue Aug 11 16:37:48 2020 +0200

            MDEV-23094: Multiple calls to a Stored Procedure from another Stored Procedure crashes server

            Added system-SELECT to IF/WHILE/REPET/FOR for correct subqueries connecting.

            Added control of system/usual selects for correct error detection.

            sanja Oleksandr Byelkin added a comment - ommit 1b61b41d6aaffebedbad330a84b5196091724956 (HEAD > bb-10.4 MDEV-23094 , 10.4) Author: Oleksandr Byelkin <sanja@mariadb.com> Date: Tue Aug 11 16:37:48 2020 +0200 MDEV-23094 : Multiple calls to a Stored Procedure from another Stored Procedure crashes server Added system-SELECT to IF/WHILE/REPET/FOR for correct subqueries connecting. Added control of system/usual selects for correct error detection.

            This script also crashes the server:

            create or replace table t1 (id1 int primary key, data1 int);
            create or replace table t2 (id2 int primary key, data2 int);
             
            delimiter //
            set sql_mode=ORACLE;
            create or replace procedure p1(id int, dt int) as
            begin
              while (1)
              loop
                exit when (exists(select * from t1 where id1 = id and data1 = dt) or
                           not exists (select * from t2 where id2 = id and data2 = dt));
              end loop;
            end;
            //
            delimiter ;
             
            call p1(1,2);
            call p1(1,2);
            

            bar Alexander Barkov added a comment - This script also crashes the server: create or replace table t1 (id1 int primary key , data1 int ); create or replace table t2 (id2 int primary key , data2 int );   delimiter // set sql_mode=ORACLE; create or replace procedure p1(id int , dt int ) as begin while (1) loop exit when (exists( select * from t1 where id1 = id and data1 = dt) or not exists ( select * from t2 where id2 = id and data2 = dt)); end loop; end ; // delimiter ;   call p1(1,2); call p1(1,2);

            Review done. The patch is generally OK. A few comments made on slack.

            bar Alexander Barkov added a comment - Review done. The patch is generally OK. A few comments made on slack.
            Han soohyun added a comment -

            Hello.

            In the case of MariaDB 10.4.13 in Win64 (windows server 2019) environment on our test development server, MariaDB forcibly encountered a shutdown issue when executing multiple calling procedures.

            You said there was no problem in version 10.3.
            We also downgraded to version 10.3.24, but the same problem occurred.

            Will there be a stable version 10.3?

            Han soohyun added a comment - Hello. In the case of MariaDB 10.4.13 in Win64 (windows server 2019) environment on our test development server, MariaDB forcibly encountered a shutdown issue when executing multiple calling procedures. You said there was no problem in version 10.3. We also downgraded to version 10.3.24, but the same problem occurred. Will there be a stable version 10.3?

            Han Are you sure that you have this problem? You probably have to make bugreport of your problem.

            sanja Oleksandr Byelkin added a comment - Han Are you sure that you have this problem? You probably have to make bugreport of your problem.

            People

              sanja Oleksandr Byelkin
              bjomol Björn Möller
              Votes:
              2 Vote for this issue
              Watchers:
              10 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.