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

bool lock_tables(THD *, TABLE_LIST *, uint, uint): Assertion `thd->lock == 0' failed

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.6, 10.11, 11.4, 11.8, 12.3, 13.0, 13.1
    • 10.6, 10.11, 11.4, 11.8, 12.3, 13.0
    • Server
    • None
    • Can result in hang or crash

    Description

      CREATE SEQUENCE sq2;
      SET @a:=LASTVAL(sq2),PASSWORD='';
      

      Leads to:

      CS 10.11.19 41cdc5630eb53e0e184cb685202c1ad7a69bb6a6 (Debug, Clang 22.1.8-20260622) Build 29/07/2026

      mariadbd: /test/10.11_dbg/sql/sql_base.cc:5998: bool lock_tables(THD *, TABLE_LIST *, uint, uint): Assertion `thd->lock == 0' failed.
      

      CS 10.11.19 41cdc5630eb53e0e184cb685202c1ad7a69bb6a6 (Debug, Clang 22.1.8-20260622) Build 29/07/2026

      Core was generated by `/test/MD290726-mariadb-10.11.19-linux-x86_64-dbg/bin/mariadbd --no-defaults --l'.
      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 1521325)]
      (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  0x00007982a6e4527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007982a6e288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007982a6e2881b in __assert_fail_base (fmt=0x7982a6fd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x620b2e54935f "thd->lock == 0", file=file@entry=0x620b2e5480d4 "/test/10.11_dbg/sql/sql_base.cc", line=line@entry=5998, function=function@entry=0x620b2e549487 "bool lock_tables(THD *, TABLE_LIST *, uint, uint)") at ./assert/assert.c:96
      #6  0x00007982a6e3b517 in __assert_fail (assertion=0x620b2e54935f "thd->lock == 0", file=0x620b2e5480d4 "/test/10.11_dbg/sql/sql_base.cc", line=5998, function=0x620b2e549487 "bool lock_tables(THD *, TABLE_LIST *, uint, uint)") at ./assert/assert.c:105
      #7  0x0000620b2d61ad45 in lock_tables (thd=0x7181a8000d58, tables=0x7181a80745f8, count=1, flags=133120)at /test/10.11_dbg/sql/sql_base.cc:5998
      #8  0x0000620b2d6066e7 in Grant_tables::open_and_lock (this=0x7982810b4090, thd=0x7181a8000d58, which_tables=128, lock_type=TL_WRITE)at /test/10.11_dbg/sql/sql_acl.cc:2090
      #9  0x0000620b2d5e280e in change_password (thd=0x7181a8000d58, user=0x7181a8013f08) at /test/10.11_dbg/sql/sql_acl.cc:4246
      #10 0x0000620b2d59d20f in set_var_password::update (this=0x7181a8013f30, thd=0x7181a8000d58) at /test/10.11_dbg/sql/set_var.cc:965
      #11 0x0000620b2d59caae in sql_set_variables (thd=0x7181a8000d58, var_list=0x7181a8005fd0, free=true) at /test/10.11_dbg/sql/set_var.cc:749
      #12 0x0000620b2d6c50c8 in mysql_execute_command (thd=0x7181a8000d58, is_called_from_prepared_stmt=false)at /test/10.11_dbg/sql/sql_parse.cc:5209
      #13 0x0000620b2d6b8d88 in mysql_parse (thd=0x7181a8000d58, rawbuf=0x7181a8013480 "SET @a:=LASTVAL(sq2),PASSWORD=''", length=32, parser_state=0x7982810b5a20) at /test/10.11_dbg/sql/sql_parse.cc:8219
      #14 0x0000620b2d6b65da in dispatch_command (command=COM_QUERY, thd=0x7181a8000d58, packet=0x7181a800af09 "SET @a:=LASTVAL(sq2),PASSWORD=''", packet_length=32, blocking=true) at /test/10.11_dbg/sql/sql_parse.cc:1924
      #15 0x0000620b2d6b980a in do_command (thd=0x7181a8000d58, blocking=true)at /test/10.11_dbg/sql/sql_parse.cc:1434
      #16 0x0000620b2d86e80e in do_handle_one_connection (connect=0x620b6d572178, put_in_cache=true) at /test/10.11_dbg/sql/sql_connect.cc:1486
      #17 0x0000620b2d86e5f5 in handle_one_connection (arg=0x620b6d66c418)at /test/10.11_dbg/sql/sql_connect.cc:1398
      #18 0x00007982a6e9cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #19 0x00007982a6f29d6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.6   dbg  290726  67ea07dd3400004e4f7ae01bf977f4344bbe064b  thd->lock == 0|SIGABRT|lock_tables|Grant_tables::open_and_lock|change_password|set_var_password::update
      CS  10.6   opt  290726  67ea07dd3400004e4f7ae01bf977f4344bbe064b  No bug found                  
      CS  10.11  dbg  290726  41cdc5630eb53e0e184cb685202c1ad7a69bb6a6  thd->lock == 0|SIGABRT|lock_tables|Grant_tables::open_and_lock|change_password|set_var_password::update
      CS  10.11  opt  290726  41cdc5630eb53e0e184cb685202c1ad7a69bb6a6  No bug found                  
      CS  11.4   dbg  290726  eccf9ca5f15bdca5b8e887396d9a570d580eb4ee  thd->lock == 0|SIGABRT|lock_tables|Grant_tables::open_and_lock|change_password|set_var_password::update
      CS  11.4   opt  290726  eccf9ca5f15bdca5b8e887396d9a570d580eb4ee  No bug found                  
      CS  11.8   dbg  290726  1d23deff797ab448f091e39756434903d81a98c2  thd->lock == 0|SIGABRT|lock_tables|Grant_tables::open_and_lock|change_password|set_var_password::update
      CS  11.8   opt  290726  1d23deff797ab448f091e39756434903d81a98c2  No bug found                  
      CS  12.3   dbg  290726  8436fe3f48173914b81f43ff0759ec493c06e767  thd->lock == 0|SIGABRT|lock_tables|Grant_tables::open_and_lock|change_password|set_var_password::update
      CS  12.3   opt  290726  8436fe3f48173914b81f43ff0759ec493c06e767  No bug found                  
      CS  13.0   dbg  290726  84c246ca5387c0611f75097136ff4f4bea092aa3  thd->lock == 0|SIGABRT|lock_tables|Grant_tables::open_and_lock|change_password|set_var_password::update
      CS  13.0   opt  290726  84c246ca5387c0611f75097136ff4f4bea092aa3  No bug found                  
      CS  13.1   dbg  290726  cded2b25e65853a75c2213cfe0832819832708bd  thd->lock == 0|SIGABRT|lock_tables|Grant_tables::open_and_lock|change_password|set_var_password::update
      CS  13.1   opt  290726  cded2b25e65853a75c2213cfe0832819832708bd  No bug found                  
      ES  10.6   dbg  290726  fcecb2620f25965723d640decede7c018bcb1dcc  thd->lock == 0|SIGABRT|lock_tables|Grant_tables::open_and_lock|change_password|set_var_password::update
      ES  11.4   dbg  290726  3b34189bfe675c18c4ced3ef531d016ea74c76f4  thd->lock == 0|SIGABRT|lock_tables|Grant_tables::open_and_lock|change_password|set_var_password::update
      ES  11.8   dbg  290726  4694e931d10fecf733c34f83ea2146d31b708eb3  thd->lock == 0|SIGABRT|lock_tables|Grant_tables::open_and_lock|change_password|set_var_password::update
      ES  12.3   dbg  290726  c1ba9a81dd4f6cdb34ca2cfe1c68ca0d68da2fca  thd->lock == 0|SIGABRT|lock_tables|Grant_tables::open_and_lock|change_password|set_var_password::update
      

      Attachments

        Activity

          People

            serg Sergei Golubchik
            saahil Saahil Alam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 1h 40m
                1h 40m

                Git Integration

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