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

280 Bytes lost in mysys/array.c, mysys/hash.c, sql/sp.cc, sql/sp.cc, sql/item_create.cc, sql/item_create.cc, sql/sql_yacc.yy:10748 when using oracle sql_mode

Details

    Description

      SET sql_mode= 'oracle';
      WHILE f(8)<1 DO SELECT 1;
      SHUTDOWN;
      

      Leads to:

      10.7.0 57f14eab20ae2733eb341f3d293515a10a40bc48 (Optimized)

      2021-07-20 18:09:19 0 [Note] /test/MD090721-mariadb-10.7.0-linux-x86_64-opt/bin/mysqld: Shutdown complete
      Warning: Memory not freed: 280
      

      10.7.0 57f14eab20ae2733eb341f3d293515a10a40bc48 (Debug)

      2021-07-20 18:09:18 0 [Note] /test/MD090721-mariadb-10.7.0-linux-x86_64-dbg/bin/mysqld: Shutdown complete
      Warning: Memory not freed: 280
      Warning:  280 bytes lost at 0x150bc0022480, allocated by T@0 at 0x55de58a978ba, mysys/array.c:71, mysys/hash.c:98, sql/sp.cc:2324, sql/sp.cc:2639, sql/item_create.cc:2601, sql/item_create.cc:2450, sql/sql_yacc.yy:10748
      Memory lost: 280 bytes in 1 chunks
      Warning:  280 bytes lost at 0x150bc0022480, allocated by T@0 at sql/sql_parse.cc:10378, mysys/array.c:71, mysys/hash.c:98, sql/sp.cc:2324, sql/sp.cc:2639, sql/item_create.cc:2601, sql/item_create.cc:2450, sql/sql_yacc.yy:10748
      Memory lost: 280 bytes in 1 chunks
      

      Present in 10.5 to 10.11, in debug and optimized. Not present in 10.2 to 10.4.

      Attachments

        Issue Links

          Activity

            Additional testcase

            SET SESSION sql_mode=ORACLE;
            BEGIN DECLARE CONTINUE HANDLER FOR SQLEXCEPTION RETURN f0();
            SHUTDOWN;
            

            10.11.2 70be59913c90e93fe5136d6f6df03c4254aa515d (Debug)

            2023-01-09 16:22:29 0 [Note] /test/MD070123-mariadb-10.11.2-linux-x86_64-dbg/bin/mysqld: Shutdown complete
            Warning: Memory not freed: 280
            

            Roel Roel Van de Paar added a comment - Additional testcase SET SESSION sql_mode=ORACLE; BEGIN DECLARE CONTINUE HANDLER FOR SQLEXCEPTION RETURN f0(); SHUTDOWN; 10.11.2 70be59913c90e93fe5136d6f6df03c4254aa515d (Debug) 2023-01-09 16:22:29 0 [Note] /test/MD070123-mariadb-10.11.2-linux-x86_64-dbg/bin/mysqld: Shutdown complete Warning: Memory not freed: 280
            bar Alexander Barkov added a comment - - edited

            Repeatable in MTR in 10.5 as of c9eff1a144ba44846373660a30d342d3f0dc91a5:

            SET sql_mode= 'oracle';
            --error ER_PARSE_ERROR
            --query WHILE f(8)<1 DO SELECT 1;
             
            --error ER_SP_BADRETURN
            BEGIN DECLARE CONTINUE HANDLER FOR SQLEXCEPTION RETURN f0();
            

            Warning: Memory not freed: 560
            Warning:  280 bytes lost at 0x7fb4d021d9c0, allocated by T@0 at mysys/array.c:72, mysys/hash.c:99, sql/sp.cc:2331, sql/sp.cc:2646, sql/item_create.cc:2631, sql/item_create.cc:2477, sql/sql_yacc.yy:10744, sql/sql_parse.cc:10497
            Warning:  280 bytes lost at 0x7fb4d000ab90, allocated by T@0 at mysys/array.c:72, mysys/hash.c:99, sql/sp.cc:2331, sql/sp.cc:2646, sql/item_create.cc:2631, sql/item_create.cc:2477, sql/sql_yacc.yy:10744, sql/sql_parse.cc:10497
            Warning:  280 bytes lost at 0x7fb4d021d9c0, allocated by T@0 at mysys/array.c:72, mysys/hash.c:99, sql/sp.cc:2331, sql/sp.cc:2646, sql/item_create.cc:2631, sql/item_create.cc:2477, sql/sql_yacc.yy:10744, sql/sql_parse.cc:10497
            Warning:  280 bytes lost at 0x7fb4d000ab90, allocated by T@0 at mysys/array.c:72, mysys/hash.c:99, sql/sp.cc:2331, sql/sp.cc:2646, sql/item_create.cc:2631, sql/item_create.cc:2477, sql/sql_yacc.yy:10744, sql/sql_parse.cc:10497
            

            bar Alexander Barkov added a comment - - edited Repeatable in MTR in 10.5 as of c9eff1a144ba44846373660a30d342d3f0dc91a5: SET sql_mode= 'oracle' ; --error ER_PARSE_ERROR --query WHILE f(8)<1 DO SELECT 1;   --error ER_SP_BADRETURN BEGIN DECLARE CONTINUE HANDLER FOR SQLEXCEPTION RETURN f0(); Warning: Memory not freed: 560 Warning: 280 bytes lost at 0x7fb4d021d9c0, allocated by T@0 at mysys/array.c:72, mysys/hash.c:99, sql/sp.cc:2331, sql/sp.cc:2646, sql/item_create.cc:2631, sql/item_create.cc:2477, sql/sql_yacc.yy:10744, sql/sql_parse.cc:10497 Warning: 280 bytes lost at 0x7fb4d000ab90, allocated by T@0 at mysys/array.c:72, mysys/hash.c:99, sql/sp.cc:2331, sql/sp.cc:2646, sql/item_create.cc:2631, sql/item_create.cc:2477, sql/sql_yacc.yy:10744, sql/sql_parse.cc:10497 Warning: 280 bytes lost at 0x7fb4d021d9c0, allocated by T@0 at mysys/array.c:72, mysys/hash.c:99, sql/sp.cc:2331, sql/sp.cc:2646, sql/item_create.cc:2631, sql/item_create.cc:2477, sql/sql_yacc.yy:10744, sql/sql_parse.cc:10497 Warning: 280 bytes lost at 0x7fb4d000ab90, allocated by T@0 at mysys/array.c:72, mysys/hash.c:99, sql/sp.cc:2331, sql/sp.cc:2646, sql/item_create.cc:2631, sql/item_create.cc:2477, sql/sql_yacc.yy:10744, sql/sql_parse.cc:10497
            bar Alexander Barkov added a comment - - edited

            With a later 10.5 which includes the fix for MDEV-30680 (e.g as of 68403eeda320ad0831563ce09a9c4af1549fe65e) the first chunk does not leak memory any more:

            SET sql_mode= 'oracle';
            --error ER_PARSE_ERROR
            --query WHILE f(8)<1 DO SELECT 1;
            

            But the second chunk still does:

            SET sql_mode= 'oracle';
            --error ER_SP_BADRETURN
            BEGIN DECLARE CONTINUE HANDLER FOR SQLEXCEPTION RETURN f0();
            

            Warning: Memory not freed: 280
            Warning:  280 bytes lost at 0x7f24b000aba0, allocated by T@0 at mysys/array.c:72, mysys/hash.c:99, sql/sp.cc:2331, sql/sp.cc:2646, sql/item_create.cc:2631, sql/item_create.cc:2477, sql/sql_yacc.yy:10767, sql/sql_parse.cc:10455
            Warning:  280 bytes lost at 0x7f24b000aba0, allocated by T@0 at mysys/array.c:72, mysys/hash.c:99, sql/sp.cc:2331, sql/sp.cc:2646, sql/item_create.cc:2631, sql/item_create.cc:2477, sql/sql_yacc.yy:10767, sql/sql_parse.cc:10455
            

            bar Alexander Barkov added a comment - - edited With a later 10.5 which includes the fix for MDEV-30680 (e.g as of 68403eeda320ad0831563ce09a9c4af1549fe65e) the first chunk does not leak memory any more: SET sql_mode= 'oracle' ; --error ER_PARSE_ERROR --query WHILE f(8)<1 DO SELECT 1; But the second chunk still does: SET sql_mode= 'oracle' ; --error ER_SP_BADRETURN BEGIN DECLARE CONTINUE HANDLER FOR SQLEXCEPTION RETURN f0(); Warning: Memory not freed: 280 Warning: 280 bytes lost at 0x7f24b000aba0, allocated by T@0 at mysys/array.c:72, mysys/hash.c:99, sql/sp.cc:2331, sql/sp.cc:2646, sql/item_create.cc:2631, sql/item_create.cc:2477, sql/sql_yacc.yy:10767, sql/sql_parse.cc:10455 Warning: 280 bytes lost at 0x7f24b000aba0, allocated by T@0 at mysys/array.c:72, mysys/hash.c:99, sql/sp.cc:2331, sql/sp.cc:2646, sql/item_create.cc:2631, sql/item_create.cc:2477, sql/sql_yacc.yy:10767, sql/sql_parse.cc:10455

            All these MTR tests also leak memory:

            SET sql_mode= 'oracle';
            --error ER_SP_LILABEL_MISMATCH
            BEGIN CONTINUE WHEN f0();
            

            SET sql_mode= 'oracle';
            --error ER_SP_LILABEL_MISMATCH
            BEGIN CONTINUE label WHEN f0();
            

            SET sql_mode= 'oracle';
            --error ER_SP_LILABEL_MISMATCH
            BEGIN EXIT WHEN f0();
            

            SET sql_mode= 'oracle';
            --error ER_SP_LILABEL_MISMATCH
            BEGIN EXIT label WHEN f0();
            

            bar Alexander Barkov added a comment - All these MTR tests also leak memory: SET sql_mode= 'oracle' ; --error ER_SP_LILABEL_MISMATCH BEGIN CONTINUE WHEN f0(); SET sql_mode= 'oracle' ; --error ER_SP_LILABEL_MISMATCH BEGIN CONTINUE label WHEN f0(); SET sql_mode= 'oracle' ; --error ER_SP_LILABEL_MISMATCH BEGIN EXIT WHEN f0(); SET sql_mode= 'oracle' ; --error ER_SP_LILABEL_MISMATCH BEGIN EXIT label WHEN f0();

            People

              bar Alexander Barkov
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.