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

SIGSEGV in TABLE::unlock_hlindexes after DELETE ... LIMIT using multi-value JSON index

    XMLWordPrintable

Details

    • Not for Release Notes
    • Q1/2027 Server Maintenance

    Description

      CREATE TABLE t1 (j JSON, INDEX (CAST(j AS JSON ARRAY)));
      INSERT INTO t1 VALUES ('[1]');
      DELETE FROM t1 WHERE 1 MEMBER OF (j) LIMIT 1;
      SELECT * FROM t1;   
      

      MDEV-38740 CS 13.1.0 30b179125daa805fc47b3996d09a9263bb414ca9 (Optimized, Clang 18.1.3-11) Build 13/10/2026

      Core was generated by `/test/mtest/MDEV-38740/MD131026-mariadb-13.1.0-linux-x86_64-opt/bin/mariadbd --'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  TABLE::unlock_hlindexes (this=0x7)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/sql/sql_base.cc:10225
       
      [Current thread is 1 (LWP 719494)]
      (gdb) bt
      #0  TABLE::unlock_hlindexes (this=0x7)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/sql/sql_base.cc:10225
      #1  0x000063d523adee0c in handler::ha_external_lock (this=0x73520c01aaf0, thd=0x73520c000c70, lock_type=2)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/sql/handler.cc:8055
      #2  0x000063d523c343eb in json_index::read_end (this=0x73520c025870, tbl=0x73520c028740)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/sql/index/json.cc:509
      #3  0x000063d5238bb80a in st_join_table::cleanup (this=this@entry=0x73520c01ac90)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/sql/sql_select.cc:16839
      #4  0x000063d5238ac61e in JOIN::cleanup (this=this@entry=0x73520c019480, full=true)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/sql/sql_select.cc:17388
      #5  0x000063d5238ab865 in JOIN::join_free (this=this@entry=0x73520c019480)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/sql/sql_select.cc:17288
      #6  0x000063d5238abe12 in do_select (join=join@entry=0x73520c019480, procedure=<optimized out>)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/sql/sql_select.cc:24318
      #7  0x000063d5238ab679 in JOIN::exec_inner (this=this@entry=0x73520c019480)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/sql/sql_select.cc:5129
      #8  0x000063d523891e30 in JOIN::exec (this=0x73520c019480)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/sql/sql_select.cc:4917
      #9  mysql_select (thd=thd@entry=0x73520c000c70, tables=<optimized out>, fields=@0x73520c017f78: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x73520c0182f0, last = 0x73520c0182f0, elements = 1}, <No data fields>}, conds=<optimized out>, og_num=<optimized out>, order=<optimized out>, group=0x0, having=0x0, proc_param=0x0, select_options=<optimized out>, result=0x73520c019450, unit=0x73520c005230, select_lex=0x73520c017cc0)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/sql/sql_select.cc:5443
      #10 0x000063d523891b10 in handle_select (thd=thd@entry=0x73520c000c70, lex=lex@entry=0x73520c005150, result=result@entry=0x73520c019450, setup_tables_done_option=setup_tables_done_option@entry=0)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/sql/sql_select.cc:640
      #11 0x000063d52385d275 in execute_sqlcom_select (thd=thd@entry=0x73520c000c70, all_tables=0x73520c018360)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/sql/sql_parse.cc:6229
      #12 0x000063d523858af1 in mysql_execute_command (thd=thd@entry=0x73520c000c70, is_called_from_prepared_stmt=false)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/sql/sql_parse.cc:3997
      #13 0x000063d523853ed2 in mysql_parse (thd=thd@entry=0x73520c000c70, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7b532422f580)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/sql/sql_parse.cc:7968
      #14 0x000063d523852490 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x73520c000c70, packet=packet@entry=0x73520c008e61 "", packet_length=packet_length@entry=16, blocking=true)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/sql/sql_parse.cc:1903
      #15 0x000063d523854351 in do_command (thd=thd@entry=0x73520c000c70, blocking=true)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/sql/sql_parse.cc:1437
      #16 0x000063d52398040d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x63d535d535e0, put_in_cache=true)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/sql/sql_connect.cc:1514
      #17 0x000063d523980242 in handle_one_connection (arg=arg@entry=0x63d535d535e0)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/sql/sql_connect.cc:1426
      #18 0x000063d523d2e5c3 in pfs_spawn_thread (arg=0x63d535d73fd0)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_opt/storage/perfschema/pfs.cc:2198
      #19 0x00007b5325e9cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #20 0x00007b5325f29ecc in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      MDEV-38740 CS 13.1.0 30b179125daa805fc47b3996d09a9263bb414ca9 (Debug, Clang 18.1.3-11) Build 13/10/2026

      mariadbd: /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_dbg/sql/handler.cc:8031: int handler::ha_external_lock(THD *, int): Assertion `inited == NONE || table->open_by_handler' failed.
      

      MDEV-38740 CS 13.1.0 30b179125daa805fc47b3996d09a9263bb414ca9 (Debug, Clang 18.1.3-11) Build 13/10/2026

      Core was generated by `/test/mtest/MDEV-38740/MD131026-mariadb-13.1.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 717367)]
      (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  0x000078bb48a4527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x000078bb48a288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000078bb48a2881b in __assert_fail_base (fmt=0x78bb48bd1208 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5e9049185899 "inited == NONE || table->open_by_handler", file=file@entry=0x5e904918337f "/test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_dbg/sql/handler.cc", line=line@entry=8031, function=function@entry=0x5e9049185797 "int handler::ha_external_lock(THD *, int)") at ./assert/assert.c:96
      #6  0x000078bb48a3b517 in __assert_fail (assertion=0x5e9049185899 "inited == NONE || table->open_by_handler", file=0x5e904918337f "/test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_dbg/sql/handler.cc", line=8031, function=0x5e9049185797 "int handler::ha_external_lock(THD *, int)")at ./assert/assert.c:105
      #7  0x00005e90483d90ae in handler::ha_external_lock (this=0x70ba5007d5d0, thd=0x70ba50000d60, lock_type=2)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_dbg/sql/handler.cc:8031
      #8  0x00005e9047dbf182 in handler::ha_external_unlock (this=0x70ba5007d5d0, thd=0x70ba50000d60)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_dbg/sql/handler.h:3773
      #9  0x00005e9047e96c78 in TABLE::unlock_hlindexes (this=0x70ba50029bb0)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_dbg/sql/sql_base.cc:10227
      #10 0x00005e90483d90cf in handler::ha_external_lock (this=0x70ba5002a010, thd=0x70ba50000d60, lock_type=2)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_dbg/sql/handler.cc:8055
      #11 0x00005e9047dbf182 in handler::ha_external_unlock (this=0x70ba5002a010, thd=0x70ba50000d60)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_dbg/sql/handler.h:3773
      #12 0x00005e90485b5943 in unlock_external (thd=0x70ba50000d60, table=0x70ba5001cda0, count=1)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_dbg/sql/lock.cc:791
      #13 0x00005e90485b5a22 in mysql_unlock_tables (thd=0x70ba50000d60, sql_lock=0x70ba5001cd80, free_lock=false)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_dbg/sql/lock.cc:482
      #14 0x00005e90485b5bdc in mysql_unlock_tables (thd=0x70ba50000d60, sql_lock=0x70ba5001cd80)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_dbg/sql/lock.cc:465
      #15 0x00005e9047e81cad in close_thread_tables (thd=0x70ba50000d60)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_dbg/sql/sql_base.cc:994
      #16 0x00005e9047e81539 in close_thread_tables_for_query (thd=0x70ba50000d60)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_dbg/sql/sql_base.cc:815
      #17 0x00005e9047f64ff6 in mysql_execute_command (thd=0x70ba50000d60, is_called_from_prepared_stmt=false)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_dbg/sql/sql_parse.cc:6009
      #18 0x00005e9047f53b94 in mysql_parse (thd=0x70ba50000d60, rawbuf=0x70ba5001a490 "DELETE FROM t1 WHERE 1 MEMBER OF (j) LIMIT 1", length=44, parser_state=0x78bb20491a80)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_dbg/sql/sql_parse.cc:7968
      #19 0x00005e9047f50ebd in dispatch_command (command=COM_QUERY, thd=0x70ba50000d60, packet=0x70ba5000b6c1 "DELETE FROM t1 WHERE 1 MEMBER OF (j) LIMIT 1", packet_length=44, blocking=true)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_dbg/sql/sql_parse.cc:1903
      #20 0x00005e9047f54743 in do_command (thd=0x70ba50000d60, blocking=true)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_dbg/sql/sql_parse.cc:1437
      #21 0x00005e904815a459 in do_handle_one_connection (connect=0x5e90683045f0, put_in_cache=true)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_dbg/sql/sql_connect.cc:1514
      #22 0x00005e904815a1fe in handle_one_connection (arg=0x5e90683f1250)at /test/mtest/MDEV-38740/bb-serg-MDEV-25848-mvi_dbg/sql/sql_connect.cc:1426
      #23 0x000078bb48a9cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #24 0x000078bb48b29ecc in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 0.5h
                  0.5h

                  Git Integration

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