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

Assertion `!(keyinfo->flag & (1LL<<20))' failed.

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 13.2
    • 13.2
    • Server
    • None
    • Can result in hang or crash

    Description

      The bug was found on main branch:-

      CREATE TABLE t1 (a GEOMETRY);
      INSERT INTO t1 VALUES (POINT(0,0));
      SET join_cache_level=8;
      SELECT 1 FROM (SELECT DISTINCT a FROM t1) dt JOIN t1 USING (a);
      

      Leads to:

      CS 13.2.0 c894d97781b54fbf074677c9d67f81cd60a162ac (Optimized, Clang 22.1.8-20260621) Build 26/10/2026

      Core was generated by `/test/MD261026-mariadb-13.2.0-linux-x86_64-opt/bin/mariadbd --no-defaults --loo'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x0000644d3226faaa in MY_HASH_ADD_STR (hasher=0x74ebbc2e7298, key=0x0, len=<optimized out>) at /test/13.1_opt/strings/strings_def.h:222
       
      [Current thread is 1 (LWP 2667432)]
      (gdb) bt
      #0  0x0000644d3226faaa in MY_HASH_ADD_STR (hasher=0x74ebbc2e7298, key=0x0, len=<optimized out>) at /test/13.1_opt/strings/strings_def.h:222
      #1  my_hash_sort_bin (hasher=0x74ebbc2e7298, cs=<optimized out>, key=<optimized out>, len=<optimized out>)at /test/13.1_opt/strings/ctype-bin.c:306
      #2  0x0000644d32037b4b in my_ci_hash_sort (hasher=0x74ebbc2e7298, ci=0x4, key=0x0, len=4) at /test/13.1_opt/include/m_ctype.h:1536
      #3  hp_hashnr (keydef=<optimized out>, key=0x6cea8401fb6d "")at /test/13.1_opt/storage/heap/hp_hash.c:308
      #4  0x0000644d3203788a in hp_search (info=info@entry=0x6cea85076140, keyinfo=keyinfo@entry=0x6cea85075cf8, key=0x0, nextflag=nextflag@entry=0)at /test/13.1_opt/storage/heap/hp_hash.c:137
      #5  0x0000644d320399be in heap_rkey (info=0x6cea85076140, record=0x6cea84059ca0 "\375\031", inx=<optimized out>, key=0x6cea8401fb60 "", keypart_map=5, find_flag=HA_READ_KEY_EXACT)at /test/13.1_opt/storage/heap/hp_rkey.c:69
      #6  0x0000644d31d62382 in handler::ha_index_read_map (this=0x6cea840596b0, buf=0x6cea84059ca0 "\375\031", key=<optimized out>, keypart_map=keypart_map@entry=1, find_flag=find_flag@entry=HA_READ_KEY_EXACT)at /test/13.1_opt/sql/handler.cc:4216
      #7  0x0000644d31b49db7 in join_read_always_key (tab=0x6cea8506c098)at /test/13.1_opt/sql/sql_select.cc:26392
      #8  0x0000644d31b1160d in sub_select (join=0x6cea8401bb20, join_tab=0x6cea8506c098, end_of_records=<optimized out>)at /test/13.1_opt/sql/sql_select.cc:25572
      #9  0x0000644d31b483bd in evaluate_join_record (join=join@entry=0x6cea8401bb20, join_tab=join_tab@entry=0x6cea8506bc20, error=<optimized out>) at /test/13.1_opt/sql/sql_select.cc:25808
      #10 0x0000644d31b11641 in sub_select (join=0x6cea8401bb20, join_tab=0x6cea8506bc20, end_of_records=<optimized out>)at /test/13.1_opt/sql/sql_select.cc:25575
      #11 0x0000644d31b2bc03 in do_select (join=join@entry=0x6cea8401bb20, procedure=<optimized out>) at /test/13.1_opt/sql/sql_select.cc:25086
      #12 0x0000644d31b2b6d9 in JOIN::exec_inner (this=this@entry=0x6cea8401bb20)at /test/13.1_opt/sql/sql_select.cc:5147
      #13 0x0000644d31b11ed7 in JOIN::exec (this=0x6cea8401bb20)at /test/13.1_opt/sql/sql_select.cc:4935
      #14 mysql_select (thd=thd@entry=0x6cea84000c70, tables=<optimized out>, fields=@0x6cea84017fa8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x6cea84018280, last = 0x6cea84018280, 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=0x6cea8401baf0, unit=0x6cea84005230, select_lex=0x6cea84017cf0)at /test/13.1_opt/sql/sql_select.cc:5461
      #15 0x0000644d31b11af0 in handle_select (thd=thd@entry=0x6cea84000c70, lex=lex@entry=0x6cea84005150, result=result@entry=0x6cea8401baf0, setup_tables_done_option=setup_tables_done_option@entry=0)at /test/13.1_opt/sql/sql_select.cc:652
      #16 0x0000644d31add257 in execute_sqlcom_select (thd=thd@entry=0x6cea84000c70, all_tables=0x6cea840199c0) at /test/13.1_opt/sql/sql_parse.cc:6266
      #17 0x0000644d31ad8afd in mysql_execute_command (thd=thd@entry=0x6cea84000c70, is_called_from_prepared_stmt=false) at /test/13.1_opt/sql/sql_parse.cc:4038
      #18 0x0000644d31ad3cfd in mysql_parse (thd=thd@entry=0x6cea84000c70, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x74ebbc2e84e0)at /test/13.1_opt/sql/sql_parse.cc:8005
      #19 0x0000644d31ad24cd in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x6cea84000c70, packet=packet@entry=0x6cea84008e31 "", packet_length=packet_length@entry=62, blocking=true)at /test/13.1_opt/sql/sql_parse.cc:1903
      #20 0x0000644d31ad4180 in do_command (thd=thd@entry=0x6cea84000c70, blocking=true) at /test/13.1_opt/sql/sql_parse.cc:1437
      #21 0x0000644d31c0235d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x644d375ce020, put_in_cache=true)at /test/13.1_opt/sql/sql_connect.cc:1514
      #22 0x0000644d31c02192 in handle_one_connection (arg=arg@entry=0x644d375ce020)at /test/13.1_opt/sql/sql_connect.cc:1426
      #23 0x0000644d31fb2723 in pfs_spawn_thread (arg=0x644d375eede0)at /test/13.1_opt/storage/perfschema/pfs.cc:2198
      #24 0x000074ebbf89cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #25 0x000074ebbf929ecc in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      CS 13.2.0 c894d97781b54fbf074677c9d67f81cd60a162ac (Debug, Clang 22.1.8-20260621) Build 26/10/2026

      mariadbd: /test/13.1_dbg/storage/heap/hp_rkey.c:34: int heap_rkey(HP_INFO *, uchar *, int, const uchar *, key_part_map, enum ha_rkey_function): Assertion `!(keyinfo->flag & (1LL<<20))' failed.
      

      CS 13.2.0 c894d97781b54fbf074677c9d67f81cd60a162ac (Debug, Clang 22.1.8-20260621) Build 26/10/2026

      Core was generated by `/test/MD261026-mariadb-13.2.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --loo'.
      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 2667471)]
      (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  0x00007f8fd0c4527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007f8fd0c288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007f8fd0c2881b in __assert_fail_base (fmt=0x7f8fd0dd1208 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x63077987e0b8 "!(keyinfo->flag & (1LL<<20))", file=file@entry=0x63077987e070 "/test/13.1_dbg/storage/heap/hp_rkey.c", line=line@entry=34, function=function@entry=0x63077987e0d5 "int heap_rkey(HP_INFO *, uchar *, int, const uchar *, key_part_map, enum ha_rkey_function)")at ./assert/assert.c:96
      #6  0x00007f8fd0c3b517 in __assert_fail (assertion=0x63077987e0b8 "!(keyinfo->flag & (1LL<<20))", file=0x63077987e070 "/test/13.1_dbg/storage/heap/hp_rkey.c", line=34, function=0x63077987e0d5 "int heap_rkey(HP_INFO *, uchar *, int, const uchar *, key_part_map, enum ha_rkey_function)") at ./assert/assert.c:105
      #7  0x0000630778ee28bc in heap_rkey (info=0x778eb909a180, record=0x778eb807ddb0 "\375\031", inx=0, key=0x778eb8022360 "", keypart_map=1, find_flag=HA_READ_KEY_EXACT)at /test/13.1_dbg/storage/heap/hp_rkey.c:34
      #8  0x0000630778edba92 in ha_heap::index_read_map (this=0x778eb807d7c0, buf=0x778eb807ddb0 "\375\031", key=0x778eb8022360 "", keypart_map=1, find_flag=HA_READ_KEY_EXACT) at /test/13.1_dbg/storage/heap/ha_heap.cc:369
      #9  0x0000630778b1296c in handler::ha_index_read_map (this=0x778eb807d7c0, buf=0x778eb807ddb0 "\375\031", key=0x778eb8022360 "", keypart_map=1, find_flag=HA_READ_KEY_EXACT) at /test/13.1_dbg/sql/handler.cc:4216
      #10 0x00006307787a5494 in join_read_always_key (tab=0x778eb9090408)at /test/13.1_dbg/sql/sql_select.cc:26392
      #11 0x000063077875aadf in sub_select (join=0x778eb801e380, join_tab=0x778eb9090408, end_of_records=false)at /test/13.1_dbg/sql/sql_select.cc:25572
      #12 0x00006307787a3eb4 in evaluate_join_record (join=0x778eb801e380, join_tab=0x778eb908ff90, error=0) at /test/13.1_dbg/sql/sql_select.cc:25808
      #13 0x000063077875ab24 in sub_select (join=0x778eb801e380, join_tab=0x778eb908ff90, end_of_records=false)at /test/13.1_dbg/sql/sql_select.cc:25575
      #14 0x000063077877eade in do_select (join=0x778eb801e380, procedure=0x0)at /test/13.1_dbg/sql/sql_select.cc:25086
      #15 0x000063077877dfc6 in JOIN::exec_inner (this=0x778eb801e380)at /test/13.1_dbg/sql/sql_select.cc:5147
      #16 0x000063077877d2e3 in JOIN::exec (this=0x778eb801e380)at /test/13.1_dbg/sql/sql_select.cc:4935
      #17 0x000063077875b32b in mysql_select (thd=0x778eb8000d60, tables=0x778eb801c220, fields=@0x778eb801a808: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x778eb801aae0, last = 0x778eb801aae0, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x778eb801e350, unit=0x778eb80052f8, select_lex=0x778eb801a550) at /test/13.1_dbg/sql/sql_select.cc:5461
      #18 0x000063077875ae8d in handle_select (thd=0x778eb8000d60, lex=0x778eb8005218, result=0x778eb801e350, setup_tables_done_option=0)at /test/13.1_dbg/sql/sql_select.cc:652
      #19 0x00006307786ff7b6 in execute_sqlcom_select (thd=0x778eb8000d60, all_tables=0x778eb801c220) at /test/13.1_dbg/sql/sql_parse.cc:6266
      #20 0x00006307786f5a4b in mysql_execute_command (thd=0x778eb8000d60, is_called_from_prepared_stmt=false) at /test/13.1_dbg/sql/sql_parse.cc:4038
      #21 0x00006307786ee718 in mysql_parse (thd=0x778eb8000d60, rawbuf=0x778eb801a460 "SELECT 1 FROM (SELECT DISTINCT a FROM t1) dt JOIN t1 USING (a)", length=62, parser_state=0x7f8fce04d9c0)at /test/13.1_dbg/sql/sql_parse.cc:8005
      #22 0x00006307786ebece in dispatch_command (command=COM_QUERY, thd=0x778eb8000d60, packet=0x778eb800b691 "", packet_length=62, blocking=true) at /test/13.1_dbg/sql/sql_parse.cc:1903
      #23 0x00006307786ef19a in do_command (thd=0x778eb8000d60, blocking=true)at /test/13.1_dbg/sql/sql_parse.cc:1437
      #24 0x00006307788ca0ce in do_handle_one_connection (connect=0x6307991c9f10, put_in_cache=true) at /test/13.1_dbg/sql/sql_connect.cc:1514
      #25 0x00006307788c9eb1 in handle_one_connection (arg=0x6307991628c0)at /test/13.1_dbg/sql/sql_connect.cc:1426
      #26 0x00007f8fd0c9cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #27 0x00007f8fd0d29ecc in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.11  dbg  261026  6a063120d4d3d451bff3ea84b3ffbee288b33be8  No bug found                  
      CS  10.11  opt  261026  6a063120d4d3d451bff3ea84b3ffbee288b33be8  No bug found                  
      CS  11.4   dbg  261026  b6406d42c8e26be3d86a4a743180f6b415a4559b  No bug found                  
      CS  11.4   opt  261026  b6406d42c8e26be3d86a4a743180f6b415a4559b  No bug found                  
      CS  11.8   dbg  261026  274dd0d8d90bc773090d13303b8d5e36d2390241  No bug found                  
      CS  11.8   opt  261026  274dd0d8d90bc773090d13303b8d5e36d2390241  No bug found                  
      CS  12.3   dbg  261026  788a07c52132d9f42b6991e599510c62d1625c0f  No bug found                  
      CS  12.3   opt  261026  788a07c52132d9f42b6991e599510c62d1625c0f  No bug found                  
      CS  13.0   dbg  261026  620a4b5624222048fece7fe1789978ae0675cae2  No bug found                  
      CS  13.0   opt  261026  620a4b5624222048fece7fe1789978ae0675cae2  No bug found                  
      CS  13.2   dbg  261026  c894d97781b54fbf074677c9d67f81cd60a162ac  !(keyinfo->flag & (1LL<<20))|SIGABRT|heap_rkey|ha_heap::index_read_map|handler::ha_index_read_map|join_read_always_key
      CS  13.2   opt  261026  c894d97781b54fbf074677c9d67f81cd60a162ac  SIGSEGV|MY_HASH_ADD_STR|my_hash_sort_bin|my_ci_hash_sort|hp_hashnr
      ES  10.6   dbg  261026  45fbb1583d8cdcc7da5a123a844b3bf512f31c9d  No bug found                  
      ES  10.6   opt  261026  45fbb1583d8cdcc7da5a123a844b3bf512f31c9d  No bug found                  
      ES  11.4   dbg  261026  6b2ae48e6e2488060adfdd02a7114bb60d4d150c  No bug found                  
      ES  11.4   opt  261026  6b2ae48e6e2488060adfdd02a7114bb60d4d150c  No bug found                  
      ES  11.8   dbg  261026  6e6ba60bdc2b3f478513c5afa3faa062d8e73736  No bug found                  
      ES  11.8   opt  261026  6e6ba60bdc2b3f478513c5afa3faa062d8e73736  No bug found                  
      ES  12.3   dbg  261026  781803ca9943d806ecb4b3b3fb39264dfafe1cf0  No bug found                  
      ES  12.3   opt  261026  781803ca9943d806ecb4b3b3fb39264dfafe1cf0  No bug found                  
      

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            saahil Saahil Alam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

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

                Git Integration

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