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

Assertion `m_using_packed_sortkeys == (sort_keys != __null && sort_keys->using_packed_sortkeys())' failed

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.6, 10.11
    • 10.6, 10.11
    • Server
    • None
    • Can result in hang or crash
    • Q4/2026 Server Maintenance

    Description

      Testcase is cli compatible

      CREATE TABLE t1 (c1 VARCHAR(132));
      INSERT INTO t1 VALUES (1),(2);
      SET SESSION debug_dbug='+d,set_num_rows_lt_MERGEBUFF';
      SELECT (SELECT 1 FROM t1 b WHERE b.c1>t1.c1 ORDER BY b.c1 LIMIT 1) FROM t1;
      

      Leads to:

      CS 10.11.19 d051e8663a8600cb899094498718859199a3ff0a (Debug, Clang 22.1.8-20260622) Build 23/06/2026

      mariadbd: /test/10.11_dbg/sql/sql_sort.h:602: bool Sort_param::using_packed_sortkeys() const: Assertion `m_using_packed_sortkeys == (sort_keys != __null && sort_keys->using_packed_sortkeys())' failed.
      

      CS 10.11.19 d051e8663a8600cb899094498718859199a3ff0a (Debug, Clang 22.1.8-20260622) Build 23/06/2026

      Core was generated by `/test/MD230626-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 1568765)]
      (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  0x00007fa8cc84527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007fa8cc8288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007fa8cc82881b in __assert_fail_base (fmt=0x7fa8cc9d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5d0fd12efb83 "m_using_packed_sortkeys == (sort_keys != __null && sort_keys->using_packed_sortkeys())", file=file@entry=0x5d0fd12efb0f "/test/10.11_dbg/sql/sql_sort.h", line=line@entry=602, function=function@entry=0x5d0fd12efbda "bool Sort_param::using_packed_sortkeys() const") at ./assert/assert.c:96
      #6  0x00007fa8cc83b517 in __assert_fail (assertion=0x5d0fd12efb83 "m_using_packed_sortkeys == (sort_keys != __null && sort_keys->using_packed_sortkeys())", file=0x5d0fd12efb0f "/test/10.11_dbg/sql/sql_sort.h", line=602, function=0x5d0fd12efbda "bool Sort_param::using_packed_sortkeys() const")at ./assert/assert.c:105
      #7  0x00005d0fd076718a in Sort_param::using_packed_sortkeys (this=0x7fa8a4b795a8) at /test/10.11_dbg/sql/sql_sort.h:601
      #8  0x00005d0fd0767f0b in filesort (thd=0x77a7ec000d58, table=0x77a7ec074f78, filesort=0x77a7ec01ada8, tracker=0x77a7ec01b328, join=0x77a7ec017240, first_table_bit=1) at /test/10.11_dbg/sql/filesort.cc:281
      #9  0x00005d0fd0482742 in create_sort_index (thd=0x77a7ec000d58, join=0x77a7ec017240, tab=0x77a7ec0781a0, fsort=0x77a7ec01ada8)at /test/10.11_dbg/sql/sql_select.cc:26632
      #10 0x00005d0fd0482412 in st_join_table::sort_table (this=0x77a7ec0781a0)at /test/10.11_dbg/sql/sql_select.cc:24134
      #11 0x00005d0fd045edba in join_init_read_record (tab=0x77a7ec0781a0)at /test/10.11_dbg/sql/sql_select.cc:24073
      #12 0x00005d0fd043f16f in sub_select (join=0x77a7ec017240, join_tab=0x77a7ec0781a0, end_of_records=false)at /test/10.11_dbg/sql/sql_select.cc:23074
      #13 0x00005d0fd0461c18 in do_select (join=0x77a7ec017240, procedure=0x0)at /test/10.11_dbg/sql/sql_select.cc:22600
      #14 0x00005d0fd04610e4 in JOIN::exec_inner (this=0x77a7ec017240)at /test/10.11_dbg/sql/sql_select.cc:5023
      #15 0x00005d0fd04604a3 in JOIN::exec (this=0x77a7ec017240)at /test/10.11_dbg/sql/sql_select.cc:4807
      #16 0x00005d0fd089c5eb in subselect_single_select_engine::exec (this=0x77a7ec0157c0) at /test/10.11_dbg/sql/item_subselect.cc:4146
      #17 0x00005d0fd088e890 in Item_subselect::exec (this=0x77a7ec015638)at /test/10.11_dbg/sql/item_subselect.cc:816
      #18 0x00005d0fd08908ef in Item_singlerow_subselect::val_int (this=0x77a7ec015638) at /test/10.11_dbg/sql/item_subselect.cc:1485
      #19 0x00005d0fd026e379 in Item::val_int_result (this=0x77a7ec015638)at /test/10.11_dbg/sql/item.h:1832
      #20 0x00005d0fd07af34a in Item_cache_int::cache_value (this=0x77a7ec078f80)at /test/10.11_dbg/sql/item.cc:10613
      #21 0x00005d0fd07b4ffc in Item_cache_wrapper::cache (this=0x77a7ec078ee0)at /test/10.11_dbg/sql/item.cc:9323
      #22 0x00005d0fd07ac029 in Item_cache_wrapper::val_int (this=0x77a7ec078ee0)at /test/10.11_dbg/sql/item.cc:9377
      #23 0x00005d0fd0656555 in Type_handler::Item_send_long (this=0x5d0fd1dff3e0 <type_handler_slong>, item=0x77a7ec078ee0, protocol=0x77a7ec001378, buf=0x7fa8a4b7a260)at /test/10.11_dbg/sql/sql_type.cc:7746
      #24 0x00005d0fd06690cd in Type_handler_long::Item_send (this=0x5d0fd1dff3e0 <type_handler_slong>, item=0x77a7ec078ee0, protocol=0x77a7ec001378, buf=0x7fa8a4b7a260)at /test/10.11_dbg/sql/sql_type.h:5794
      #25 0x00005d0fd026de3d in Item::send (this=0x77a7ec078ee0, protocol=0x77a7ec001378, buffer=0x7fa8a4b7a260)at /test/10.11_dbg/sql/item.h:1266
      #26 0x00005d0fd07abd10 in Item_cache_wrapper::send (this=0x77a7ec078ee0, protocol=0x77a7ec001378, buffer=0x7fa8a4b7a260)at /test/10.11_dbg/sql/item.cc:9229
      #27 0x00005d0fd02b02ec in Protocol::send_result_set_row (this=0x77a7ec001378, row_items=0x77a7ec013830) at /test/10.11_dbg/sql/protocol.cc:1333
      #28 0x00005d0fd0361e9e in select_send::send_data (this=0x77a7ec016950, items=@0x77a7ec013830: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x77a7ec015800, last = 0x77a7ec015800, elements = 1}, <No data fields>})at /test/10.11_dbg/sql/sql_class.cc:3213
      #29 0x00005d0fd0497f3f in select_result_sink::send_data_with_check (this=0x77a7ec016950, items=@0x77a7ec013830: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x77a7ec015800, last = 0x77a7ec015800, elements = 1}, <No data fields>}, u=0x77a7ec005028, sent=1) at /test/10.11_dbg/sql/sql_class.h:6077
      #30 0x00005d0fd045bd4f in end_send (join=0x77a7ec016978, join_tab=0x77a7ec018a98, end_of_records=false)at /test/10.11_dbg/sql/sql_select.cc:24366
      #31 0x00005d0fd048146c in evaluate_join_record (join=0x77a7ec016978, join_tab=0x77a7ec0186d0, error=0)at /test/10.11_dbg/sql/sql_select.cc:23307
      #32 0x00005d0fd043f333 in sub_select (join=0x77a7ec016978, join_tab=0x77a7ec0186d0, end_of_records=false)at /test/10.11_dbg/sql/sql_select.cc:23116
      #33 0x00005d0fd0461c18 in do_select (join=0x77a7ec016978, procedure=0x0)at /test/10.11_dbg/sql/sql_select.cc:22600
      #34 0x00005d0fd04610e4 in JOIN::exec_inner (this=0x77a7ec016978)at /test/10.11_dbg/sql/sql_select.cc:5023
      #35 0x00005d0fd04604a3 in JOIN::exec (this=0x77a7ec016978)at /test/10.11_dbg/sql/sql_select.cc:4807
      #36 0x00005d0fd043f9fd in mysql_select (thd=0x77a7ec000d58, tables=0x77a7ec015908, fields=@0x77a7ec013830: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x77a7ec015800, last = 0x77a7ec015800, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x77a7ec016950, unit=0x77a7ec005028, select_lex=0x77a7ec013578) at /test/10.11_dbg/sql/sql_select.cc:5285
      #37 0x00005d0fd043f4fd in handle_select (thd=0x77a7ec000d58, lex=0x77a7ec004f50, result=0x77a7ec016950, setup_tables_done_option=0)at /test/10.11_dbg/sql/sql_select.cc:601
      #38 0x00005d0fd03ee1c5 in execute_sqlcom_select (thd=0x77a7ec000d58, all_tables=0x77a7ec015908) at /test/10.11_dbg/sql/sql_parse.cc:6461
      #39 0x00005d0fd03e3666 in mysql_execute_command (thd=0x77a7ec000d58, is_called_from_prepared_stmt=false)at /test/10.11_dbg/sql/sql_parse.cc:4040
      #40 0x00005d0fd03dc3e8 in mysql_parse (thd=0x77a7ec000d58, rawbuf=0x77a7ec013480 "SELECT (SELECT 1 FROM t1 b WHERE b.c1>t1.c1 ORDER BY b.c1 LIMIT 1) FROM t1", length=74, parser_state=0x7fa8a4b7ca20)at /test/10.11_dbg/sql/sql_parse.cc:8221
      #41 0x00005d0fd03d9c3a in dispatch_command (command=COM_QUERY, thd=0x77a7ec000d58, packet=0x77a7ec00af09 "", packet_length=74, blocking=true) at /test/10.11_dbg/sql/sql_parse.cc:1924
      #42 0x00005d0fd03dce6a in do_command (thd=0x77a7ec000d58, blocking=true)at /test/10.11_dbg/sql/sql_parse.cc:1434
      #43 0x00005d0fd05914ae in do_handle_one_connection (connect=0x5d10040582e8, put_in_cache=true) at /test/10.11_dbg/sql/sql_connect.cc:1482
      #44 0x00005d0fd0591295 in handle_one_connection (arg=0x5d1004152588)at /test/10.11_dbg/sql/sql_connect.cc:1394
      #45 0x00007fa8cc89caa4 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #46 0x00007fa8cc929c6c 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  230626  8eda90189340c31f7dfbae9ed870bfd8c0ad1776  m_using_packed_sortkeys == (sort_keys != __null && sort_keys->using_packed_sortkeys())|SIGABRT|Sort_param::using_packed_sortkeys|filesort|create_sort_index|st_join_table::sort_table
      CS  10.6   opt  220626  8eda90189340c31f7dfbae9ed870bfd8c0ad1776  No bug found                  
      CS  10.11  dbg  230626  d051e8663a8600cb899094498718859199a3ff0a  m_using_packed_sortkeys == (sort_keys != __null && sort_keys->using_packed_sortkeys())|SIGABRT|Sort_param::using_packed_sortkeys|filesort|create_sort_index|st_join_table::sort_table
      CS  10.11  opt  220626  d051e8663a8600cb899094498718859199a3ff0a  No bug found                  
      CS  11.4   dbg  230626  bbd558c38616ce24bd2973486763c2a7c4db0969  No bug found                  
      CS  11.4   opt  220626  bbd558c38616ce24bd2973486763c2a7c4db0969  No bug found                  
      CS  11.8   dbg  230626  eccdef627382b7b1f5338450ba328d16216c4fa2  No bug found                  
      CS  11.8   opt  220626  eccdef627382b7b1f5338450ba328d16216c4fa2  No bug found                  
      CS  12.3   dbg  250626  c46441bc5f19f6b10dc1c3a2513d963c496e6578  No bug found                  
      CS  12.3   opt  220626  c46441bc5f19f6b10dc1c3a2513d963c496e6578  No bug found                  
      CS  12.3   opt  250626  c46441bc5f19f6b10dc1c3a2513d963c496e6578  No bug found                  
      CS  13.0   dbg  290626  eb0f3282ae8d1f3762c86d682dba99c892498049  No bug found                  
      CS  13.0   opt  290626  eb0f3282ae8d1f3762c86d682dba99c892498049  No bug found                  
      ES  10.6   dbg  230626  e05a2b2ddaa1032a24924a6e1a12acd467abf4da  m_using_packed_sortkeys == (sort_keys != __null && sort_keys->using_packed_sortkeys())|SIGABRT|Sort_param::using_packed_sortkeys|filesort|create_sort_index|st_join_table::sort_table
      ES  10.6   opt  220626  e05a2b2ddaa1032a24924a6e1a12acd467abf4da  No bug found                  
      ES  11.4   dbg  230626  5b6db6d09008ba92cfc5a2ef980ab86badf70d12  No bug found                  
      ES  11.4   opt  220626  5b6db6d09008ba92cfc5a2ef980ab86badf70d12  No bug found                  
      ES  11.8   dbg  230626  cc48b2b61be04be37daa2badcf254d96a26d2ba7  No bug found                  
      ES  11.8   opt  220626  cc48b2b61be04be37daa2badcf254d96a26d2ba7  No bug found                  
      ES  12.3   dbg  230626  a1d3628ea75207c85664946574ff803cbfc7c511  No bug found                  
      ES  12.3   opt  220626  a1d3628ea75207c85664946574ff803cbfc7c511  No bug found                  
      

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            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 - 0.25d
                0.25d

                Git Integration

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