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

Assertion `status_var.local_memory_used == 0 || !debug_assert_on_not_freed_memory' failed in THD::~THD on PREPARE and SHUTDOWN, Warning: Memory not freed: 16448/16496/16808

    XMLWordPrintable

Details

    Description

      MTR testcase:

      CREATE TABLE t (c1 INT, c2 DATE) TABLESPACE t STORAGE MEMORY;
        
      --let $_server_id= `SELECT @@server_id`
      --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
      --exec echo "wait" > $_expect_file_name
       
      --connect (c1,localhost,root,,)
       
      --error ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT
      PREPARE s FROM 'WITH RECURSIVE d AS (SELECT * FROM t UNION ALL SELECT 1 FROM d) SELECT * FROM d AS d1,d AS d2';
       
      --send shutdown
      --connection default
      --source include/wait_until_disconnected.inc
       
      --exec echo "restart" > $_expect_file_name
      --enable_reconnect
      --source include/wait_until_connected_again.inc
       
      drop table t;
      

      Possibly related to MDEV-21837, though there are some differences.

      CLI testcase:

      CREATE TABLE t (c1 INT, c2 DATE) TABLESPACE t STORAGE MEMORY;
      PREPARE s FROM 'WITH RECURSIVE d AS (SELECT * FROM t UNION ALL SELECT 1 FROM d) SELECT * FROM d AS d1,d AS d2';
      SHUTDOWN;
      

      Leads to:

      10.6.2 6c39eaeb126328e7813b146ecf652d51e4508981 (Debug)

      mysqld: /test/10.6_dbg/sql/sql_class.cc:1745: virtual THD::~THD(): Assertion `status_var.local_memory_used == 0 || !debug_assert_on_not_freed_memory' failed.
      

      10.6.2 6c39eaeb126328e7813b146ecf652d51e4508981 (Debug)

      Core was generated by `/test/MD120621-mariadb-10.6.2-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      [Current thread is 1 (Thread 0x150470d4a700 (LWP 3945354))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x0000150473908859 in __GI_abort () at abort.c:79
      #2  0x0000150473908729 in __assert_fail_base (fmt=0x150473a9e588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5648de91ede8 "status_var.local_memory_used == 0 || !debug_assert_on_not_freed_memory", file=0x5648de91d068 "/test/10.6_dbg/sql/sql_class.cc", line=1745, function=<optimized out>) at assert.c:92
      #3  0x0000150473919f36 in __GI___assert_fail (assertion=assertion@entry=0x5648de91ede8 "status_var.local_memory_used == 0 || !debug_assert_on_not_freed_memory", file=file@entry=0x5648de91d068 "/test/10.6_dbg/sql/sql_class.cc", line=line@entry=1745, function=function@entry=0x5648de91fc50 "virtual THD::~THD()") at assert.c:101
      #4  0x00005648ddc25b6f in THD::~THD (this=0x15042c000db8, __in_chrg=<optimized out>) at /test/10.6_dbg/sql/sql_class.cc:1745
      #5  0x00005648ddc25ba1 in THD::~THD (this=0x15042c000db8, __in_chrg=<optimized out>) at /test/10.6_dbg/sql/sql_class.cc:1660
      #6  0x00005648dddf1162 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5648e0bdd418, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1451
      #7  0x00005648dddf1293 in handle_one_connection (arg=arg@entry=0x5648e0bdd418) at /test/10.6_dbg/sql/sql_connect.cc:1312
      #8  0x00005648de29f166 in pfs_spawn_thread (arg=0x5648e0ac6078) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
      #9  0x0000150473e16609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #10 0x0000150473a05293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.2.39 (dbg), 10.3.30 (dbg), 10.4.20 (dbg), 10.5.11 (dbg), 10.6.2 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.2.39 (opt), 10.3.30 (opt), 10.4.20 (opt), 10.5.11 (opt), 10.6.2 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.34 (dbg), 5.7.34 (opt), 8.0.24 (dbg), 8.0.24 (opt)

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.