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

Assertion fails in alloc_root() after max_session_mem_used is hit

    XMLWordPrintable

Details

    Description

      --source include/have_innodb.inc
       
      SET max_session_mem_used=8192;
      CREATE TEMPORARY TABLE t1 (a INT,b INT) ENGINE=INNODB;
      INSERT INTO t1 VALUES (1,1);
      SELECT * FROM (t1 AS t2 LEFT JOIN t1 AS t3 USING (a)),t1;
      

      Leads to:

      CS 10.6.21 faca9500fb3c1e5c56d9626f606df8de67513bc1 (Debug)

      mariadbd: /test/10.6_dbg/mysys/my_alloc.c:263: alloc_root: Assertion `*prev == 0' failed.
      

      CS 10.6.21 faca9500fb3c1e5c56d9626f606df8de67513bc1 (Debug)

      Core was generated by `/test/MD130125-mariadb-10.6.21-linux-x86_64-dbg/bin/mariadbd --no-defaults --ma'.
      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 0x1538ac155700 (LWP 3109995))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x00001538bc7a4859 in __GI_abort () at abort.c:79
      #2  0x00001538bc7a4729 in __assert_fail_base (fmt=0x1538bc93a588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x561fe2556400 "*prev == 0", file=0x561fe2556410 "/test/10.6_dbg/mysys/my_alloc.c", line=263, function=<optimized out>) at assert.c:92
      #3  0x00001538bc7b5fd6 in __GI___assert_fail (assertion=assertion@entry=0x561fe2556400 "*prev == 0", file=file@entry=0x561fe2556410 "/test/10.6_dbg/mysys/my_alloc.c", line=line@entry=263, function=function@entry=0x561fe2556460 <__PRETTY_FUNCTION__.17728> "alloc_root") at assert.c:101
      #4  0x0000561fe20a602b in alloc_root (mem_root=0x153878006ae0, length=288) at /test/10.6_dbg/mysys/my_alloc.c:263
      #5  0x0000561fe1553e7c in Sql_alloc::operator new (size=<optimized out>, mem_root=<optimized out>) at /test/10.6_dbg/sql/sql_alloc.h:37
      #6  0x0000561fe168cce9 in check_join_cache_usage (tab=tab@entry=0x153878019f20, options=options@entry=0, no_jbuf_after=no_jbuf_after@entry=3, table_index=table_index@entry=2, prev_tab=0x153878019b60) at /test/10.6_dbg/sql/sql_select.cc:14349
      #7  0x0000561fe168d1e2 in check_join_cache_usage_for_tables (join=join@entry=0x153878016098, options=options@entry=0, no_jbuf_after=no_jbuf_after@entry=3) at /test/10.6_dbg/sql/sql_select.cc:14508
      #8  0x0000561fe168d4d5 in make_join_readinfo (join=join@entry=0x153878016098, options=options@entry=0, no_jbuf_after=no_jbuf_after@entry=3) at /test/10.6_dbg/sql/sql_select.cc:14680
      #9  0x0000561fe168f7e4 in JOIN::optimize_stage2 (this=this@entry=0x153878016098) at /test/10.6_dbg/sql/sql_select.cc:3193
      #10 0x0000561fe1691895 in JOIN::optimize_inner (this=this@entry=0x153878016098) at /test/10.6_dbg/sql/sql_select.cc:2639
      #11 0x0000561fe1691b06 in JOIN::optimize (this=this@entry=0x153878016098) at /test/10.6_dbg/sql/sql_select.cc:1927
      #12 0x0000561fe1691bcd in mysql_select (thd=thd@entry=0x153878000d48, tables=0x153878013998, fields=@0x153878013610: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x153878013938, last = 0x153878017378, elements = 5}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x153878016070, unit=0x153878004f28, select_lex=0x153878013350) at /test/10.6_dbg/sql/sql_select.cc:5182
      #13 0x0000561fe169237c in handle_select (thd=thd@entry=0x153878000d48, lex=lex@entry=0x153878004e60, result=result@entry=0x153878016070, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.6_dbg/sql/sql_select.cc:573
      #14 0x0000561fe1606421 in execute_sqlcom_select (thd=thd@entry=0x153878000d48, all_tables=0x153878013998) at /test/10.6_dbg/sql/sql_parse.cc:6421
      #15 0x0000561fe1613471 in mysql_execute_command (thd=thd@entry=0x153878000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.6_dbg/sql/sql_parse.cc:4013
      #16 0x0000561fe15ff2f1 in mysql_parse (thd=thd@entry=0x153878000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1538ac154340) at /test/10.6_dbg/sql/sql_parse.cc:8208
      #17 0x0000561fe160e595 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x153878000d48, packet=packet@entry=0x15387800add9 "SELECT * FROM (t1 AS t2 LEFT JOIN t1 AS t3 USING (a)),t1", packet_length=packet_length@entry=56, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1418
      #18 0x0000561fe1610f00 in do_command (thd=thd@entry=0x153878000d48, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1421
      #19 0x0000561fe176d62a in do_handle_one_connection (connect=<optimized out>, connect@entry=0x561fe3b2a988, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1386
      #20 0x0000561fe176da97 in handle_one_connection (arg=0x561fe3b2a988) at /test/10.6_dbg/sql/sql_connect.cc:1298
      #21 0x00001538bccd0609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #22 0x00001538bc8a1133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.6.21 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.5.28 (dbg), 10.5.28 (opt), 10.6.21 (opt), 10.11.11 (dbg), 10.11.11 (opt), 11.4.5 (dbg), 11.4.5 (opt), 11.7.1 (dbg), 11.7.1 (opt), 11.8.0 (dbg), 11.8.0 (opt)

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              ramesh Ramesh Sivaraman
              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.