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

Assertion `!thd->free_list' failed in bool MYSQL_QUERY_LOG::write(THD *, time_t, const char *, size_t, ulonglong, ulonglong, bool, const char *, size_t)

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      SET GLOBAL slow_query_log=ON;
       
      DELIMITER $$;
      CREATE PROCEDURE p1() 
        BEGIN DECLARE c sys_refcursor;
        OPEN c FOR SELECT SLEEP(1);
        CLOSE c;
      END;
      $$
      DELIMITER ;$$
       
      SET SESSION authorization root@localhost;
      SET SESSION log_slow_verbosity='explain';
      SET log_slow_disabled_statements=admin;
      SET long_query_time=1;
      USE test;
      CALL p1();
      

      Leads to:

      MDEV-33830 CS 12.3.0 0b4d942b423640d55afe571a79d26162f52d8d9d (Debug, Clang 18.1.3-11) Build 16/12/2025

      mariadbd: /test/mtest/MDEV-33830/12.3_dbg/sql/log.cc:3531: bool MYSQL_QUERY_LOG::write(THD *, time_t, const char *, size_t, ulonglong, ulonglong, bool, const char *, size_t): Assertion `!thd->free_list' failed.
      

      MDEV-33830 CS 12.3.0 0b4d942b423640d55afe571a79d26162f52d8d9d (Debug, Clang 18.1.3-11) Build 16/12/2025

      Core was generated by `/test/mtest/MDEV-33830/MD161225-mariadb-12.3.0-linux-x86_64-dbg/bin/mariadbd --'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
       
      [Current thread is 1 (LWP 3813810)]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)at ./nptl/pthread_kill.c:89
      #3  0x00007c27a724527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007c27a72288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007c27a722881b in __assert_fail_base (fmt=0x7c27a73d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5fc4233330eb "!thd->free_list", file=file@entry=0x5fc423332249 "/test/mtest/MDEV-33830/12.3_dbg/sql/log.cc", line=line@entry=3531, function=function@entry=0x5fc4233330fb "bool MYSQL_QUERY_LOG::write(THD *, time_t, const char *, size_t, ulonglong, ulonglong, bool, const char *, size_t)") at ./assert/assert.c:96
      #6  0x00007c27a723b517 in __assert_fail (assertion=0x5fc4233330eb "!thd->free_list", file=0x5fc423332249 "/test/mtest/MDEV-33830/12.3_dbg/sql/log.cc", line=3531, function=0x5fc4233330fb "bool MYSQL_QUERY_LOG::write(THD *, time_t, const char *, size_t, ulonglong, ulonglong, bool, const char *, size_t)")at ./assert/assert.c:105
      #7  0x00005fc422722e5f in MYSQL_QUERY_LOG::write (this=0x5fc43c88dae8, thd=0x7c267c000d58, current_time=1765938551, user_host=0x7c27a4262eb0 "root[root] @ localhost []", user_host_len=25, query_utime=1001747, lock_utime=85, is_command=false, sql_text=0x7c267c03cf5c "SELECT SLEEP(1)", sql_text_len=15)at /test/mtest/MDEV-33830/12.3_dbg/sql/log.cc:3531
      #8  0x00005fc4227222e6 in Log_to_file_event_handler::log_slow (this=0x5fc43c88d5b0, thd=0x7c267c000d58, current_time={val = 1765938551908333}, user_host=0x7c27a4262eb0 "root[root] @ localhost []", user_host_len=25, query_utime=1001747, lock_utime=85, is_command=false, sql_text=0x7c267c03cf5c "SELECT SLEEP(1)", sql_text_len=15)at /test/mtest/MDEV-33830/12.3_dbg/sql/log.cc:1223
      #9  0x00005fc422724a15 in LOGGER::slow_log_print (this=0x5fc423ec8298 <logger>, thd=0x7c267c000d58, query=0x7c267c03cf5c "SELECT SLEEP(1)", query_length=15, current_utime=413762607913)at /test/mtest/MDEV-33830/12.3_dbg/sql/log.cc:1500
      #10 0x00005fc422736d74 in slow_log_print (thd=0x7c267c000d58, query=0x7c267c03cf5c "SELECT SLEEP(1)", query_length=15, current_utime=413762607913)at /test/mtest/MDEV-33830/12.3_dbg/sql/log.cc:7753
      #11 0x00005fc422130ff4 in log_slow_statement (thd=0x7c267c000d58)at /test/mtest/MDEV-33830/12.3_dbg/sql/sql_parse.cc:2587
      #12 0x00005fc4220afb69 in mysql_open_cursor (thd=0x7c267c000d58, result=0x7c267c0390c8, pcursor=0x7c267c039100)at /test/mtest/MDEV-33830/12.3_dbg/sql/sql_cursor.cc:132
      #13 0x00005fc422024280 in sp_cursor::open (this=0x7c267c0390a8, thd=0x7c267c000d58, check_open_cursor_counter=true)at /test/mtest/MDEV-33830/12.3_dbg/sql/sp_rcontext.cc:848
      #14 0x00005fc4223fb545 in sp_instr_copen_by_ref::exec_core (this=0x7c267c03cf70, thd=0x7c267c000d58, nextp=0x7c27a4263798)at /test/mtest/MDEV-33830/12.3_dbg/sql/sp_instr.cc:2673
      #15 0x00005fc4223f4586 in sp_lex_keeper::reset_lex_and_exec_core (this=0x7c267c03cfb0, thd=0x7c267c000d58, nextp=0x7c27a4263798, open_tables=false, instr=0x7c267c03cf70, rerun_the_same_instr=false)at /test/mtest/MDEV-33830/12.3_dbg/sql/sp_instr.cc:420
      #16 0x00005fc4223f4d0c in sp_lex_keeper::validate_lex_and_exec_core (this=0x7c267c03cfb0, thd=0x7c267c000d58, nextp=0x7c27a4263798, open_tables=false, instr=0x7c267c03cf70)at /test/mtest/MDEV-33830/12.3_dbg/sql/sp_instr.cc:599
      #17 0x00005fc4223f59ca in sp_lex_keeper::cursor_reset_lex_and_exec_core (this=0x7c267c03cfb0, thd=0x7c267c000d58, nextp=0x7c27a4263798, open_tables=false, instr=0x7c267c03cf70)at /test/mtest/MDEV-33830/12.3_dbg/sql/sp_instr.cc:654
      #18 0x00005fc4223fb1af in sp_instr_copen_by_ref::execute (this=0x7c267c03cf70, thd=0x7c267c000d58, nextp=0x7c27a4263798)at /test/mtest/MDEV-33830/12.3_dbg/sql/sp_instr.cc:2634
      #19 0x00005fc42200bffc in sp_head::execute (this=0x7c267c03b320, thd=0x7c267c000d58, merge_da_on_success=true)at /test/mtest/MDEV-33830/12.3_dbg/sql/sp_head.cc:1294
      #20 0x00005fc42200e99e in sp_head::execute_procedure (this=0x7c267c03b320, thd=0x7c267c000d58, args=0x7c267c006128)at /test/mtest/MDEV-33830/12.3_dbg/sql/sp_head.cc:2331
      #21 0x00005fc4221334f7 in do_execute_sp (thd=0x7c267c000d58, sp=0x7c267c03b320)at /test/mtest/MDEV-33830/12.3_dbg/sql/sql_parse.cc:3056
      #22 0x00005fc422133018 in Sql_cmd_call::execute (this=0x7c267c019f88, thd=0x7c267c000d58)at /test/mtest/MDEV-33830/12.3_dbg/sql/sql_parse.cc:3279
      #23 0x00005fc42213f3f1 in mysql_execute_command (thd=0x7c267c000d58, is_called_from_prepared_stmt=false)at /test/mtest/MDEV-33830/12.3_dbg/sql/sql_parse.cc:5861
      #24 0x00005fc42212e6c4 in mysql_parse (thd=0x7c267c000d58, rawbuf=0x7c267c019ee0 "CALL p1()", length=9, parser_state=0x7c27a4265ac0)at /test/mtest/MDEV-33830/12.3_dbg/sql/sql_parse.cc:7895
      #25 0x00005fc42212ba98 in dispatch_command (command=COM_QUERY, thd=0x7c267c000d58, packet=0x7c267c00b239 "CALL p1()", packet_length=9, blocking=true) at /test/mtest/MDEV-33830/12.3_dbg/sql/sql_parse.cc:1878
      #26 0x00005fc42212f273 in do_command (thd=0x7c267c000d58, blocking=true)at /test/mtest/MDEV-33830/12.3_dbg/sql/sql_parse.cc:1417
      #27 0x00005fc42231e599 in do_handle_one_connection (connect=0x5fc43cf7dd28, put_in_cache=true)at /test/mtest/MDEV-33830/12.3_dbg/sql/sql_connect.cc:1503
      #28 0x00005fc42231e33e in handle_one_connection (arg=0x5fc43cf8edc8)at /test/mtest/MDEV-33830/12.3_dbg/sql/sql_connect.cc:1415
      #29 0x00007c27a729caa4 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #30 0x00007c27a7329c6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.