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

Warning: Memory not freed: 280 on mangled query, LeakSanitizer: detected memory leaks

Details

    Description

      Present in 10.5+ only, both in debug and optimized.

      IF(NOT (scalar (@0s)>scalar (@0s))) { die (.);�ku u va�oj SQL sINTaksi{ die (. na liniji0;;
      SHUTDOWN;
      

      Leads to (ref error log after shutdown):

      11.0.1 f2dc4d4c10ac36a73b5c1eb765352d3aee808d66 (Debug)

      2023-02-18 14:22:07 0 [Note] /test/MD180223-mariadb-11.0.1-linux-x86_64-dbg/bin/mariadbd: Shutdown complete
      Warning: Memory not freed: 280
      

      In all affected versions.

      No UBSAN/ASAN issues observed.

      I tried to make this work under MTR for some time, but failed. AFAICS ftm, this issue can only be reproduced in a client, not in MTR, not even when using the CLI via MTR i.e. --start-and-exit.

      As such, you will need to start mariadbd and then mariadb manually/directly to reproduce.

      Attachments

        Issue Links

          Activity

            shulga Could you have a look at the patch please? We see this error somewhat regularly in testing. Thank you!

            Roel Roel Van de Paar added a comment - shulga Could you have a look at the patch please? We see this error somewhat regularly in testing. Thank you!
            Roel Roel Van de Paar added a comment - - edited

            Please also test

            IF(NOT (SCALAR (@0s)>SCALAR (@0s))) { die (.);
            SHUTDOWN;
            

            Against LSAN.

            LSAN|memory leak|mysys/my_malloc.c|malloc|my_malloc|init_dynamic_array2|sp_add_used_routine
            

            Roel Roel Van de Paar added a comment - - edited Please also test IF ( NOT (SCALAR (@0s)>SCALAR (@0s))) { die (.); SHUTDOWN; Against LSAN. LSAN|memory leak|mysys/my_malloc.c|malloc|my_malloc|init_dynamic_array2|sp_add_used_routine
            shulga Dmitry Shulga added a comment -

            The patch approved

            shulga Dmitry Shulga added a comment - The patch approved
            bar Alexander Barkov added a comment - - edited

            The problem is also repeatable with:

            DELIMITER $$
            BEGIN NOT ATOMIC
              DECLARE cur CURSOR (a INT) FOR SELECT a+1;
              OPEN cur(sp_followed_by_syntax_error();
              CLOSE cur;
            END;
            $$
            DELIMITER ;
            

            It's now reported as a separate issue MDEV-31578.

            bar Alexander Barkov added a comment - - edited The problem is also repeatable with: DELIMITER $$ BEGIN NOT ATOMIC DECLARE cur CURSOR (a INT ) FOR SELECT a+1; OPEN cur(sp_followed_by_syntax_error(); CLOSE cur; END ; $$ DELIMITER ; It's now reported as a separate issue MDEV-31578 .
            bar Alexander Barkov added a comment - The new patch is here: https://github.com/MariaDB/server/commit/575ab6d3fd8d2d311d55391d54f3f665c3ae07ac

            People

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