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

Connect: SIGSEGV in DTVAL::FormatValue on SELECT, Subpartition psp0 returned error, internal error 160

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      INSTALL SONAME 'ha_connect';
      CREATE TABLE t (c INT,c2 DATE,PRIMARY KEY(c2,c)) ENGINE=Connect PARTITION BY RANGE (TO_DAYS(c2)) SUBPARTITION BY HASH (c) SUBPARTITIONS 2 (PARTITION p VALUES LESS THAN (1));
      INSERT INTO t VALUES (0,0);
      LOCK TABLES t READ ;
      CHECK TABLE t;
      SELECT * FROM t;
      

      Leads to:

      CS 12.2.0 fd15fd2765b53d0c070dd01d86fb231024b8f284 (Optimized, Clang 21.1.3-20250923) Build 10/11/2025

      12.2.0-opt>CHECK TABLE t;
      +--------+-------+----------+-----------------------------------------------+
      | Table  | Op    | Msg_type | Msg_text                                      |
      +--------+-------+----------+-----------------------------------------------+
      | test.t | check | error    | Subpartition psp0 returned error              |
      | test.t | check | error    | Unknown - internal error 160 during operation |
      +--------+-------+----------+-----------------------------------------------+
      2 rows in set (0.000 sec)
       
      12.2.0-opt>SELECT * FROM t;
      ERROR 2026 (HY000): TLS/SSL error: The TLS connection was non-properly terminated.
      

      CS 12.2.0 fd15fd2765b53d0c070dd01d86fb231024b8f284 (Optimized, Clang 21.1.3-20250923) Build 10/11/2025

      Core was generated by `/test/MD101125-mariadb-12.2.0-linux-x86_64-opt/bin/mariadbd --no-defaults --max'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x0000706a743867be in DTVAL::FormatValue (this=0x70693fe00e98, vp=0x70693fe00878, fmt=0x706a742cc913 "%Y-%m-%d")at /test/12.2_opt/storage/connect/value.cpp:2874
       
      [Current thread is 1 (LWP 3978839)]
      (gdb) bt
      #0  0x0000706a743867be in DTVAL::FormatValue (this=0x70693fe00e98, vp=0x70693fe00878, fmt=0x706a742cc913 "%Y-%m-%d")at /test/12.2_opt/storage/connect/value.cpp:2874
      #1  0x0000706a743117ab in ha_connect::MakeRecord (this=this@entry=0x706944035f58, buf=buf@entry=0x70694402bc62 "")at /test/12.2_opt/storage/connect/ha_connect.cc:2239
      #2  0x0000706a74315c17 in ha_connect::ReadIndexed (this=0x706944035f58, buf=0x70694402bc62 "", op=OP_FIRST, kr=<optimized out>)at /test/12.2_opt/storage/connect/ha_connect.cc:3882
      #3  0x000057842c017d60 in handler::ha_index_first (this=0x706944035f58, buf=0x70694402bc62 "") at /test/12.2_opt/sql/handler.cc:3999
      #4  0x000057842c5f238f in ha_partition::handle_ordered_index_scan (this=0x706944035658, buf=0x706944037328 "\377", reverse_order=<optimized out>) at /test/12.2_opt/sql/ha_partition.cc:8021
      #5  0x000057842c017d60 in handler::ha_index_first (this=0x706944035658, buf=0x706944037328 "\377") at /test/12.2_opt/sql/handler.cc:3999
      #6  0x000057842c36304f in join_read_first (tab=0x70694401a7f8)at /test/12.2_opt/sql/sql_select.cc:25701
      #7  0x000057842c323007 in sub_select (join=0x706944018e38, join_tab=0x70694401a7f8, end_of_records=<optimized out>)at /test/12.2_opt/sql/sql_select.cc:24554
      #8  0x000057842c33e6b2 in do_select (join=join@entry=0x706944018e38, procedure=<optimized out>) at /test/12.2_opt/sql/sql_select.cc:24068
      #9  0x000057842c33e12a in JOIN::exec_inner (this=this@entry=0x706944018e38)at /test/12.2_opt/sql/sql_select.cc:5134
      #10 0x000057842c323955 in JOIN::exec (this=0x706944018e38)at /test/12.2_opt/sql/sql_select.cc:4922
      #11 mysql_select (thd=thd@entry=0x706944000c68, tables=<optimized out>, fields=@0x706944017a10: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x706944017d58, last = 0x706944019880, elements = 2}, <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=0x706944018e10, unit=0x7069440050b0, select_lex=0x706944017758)at /test/12.2_opt/sql/sql_select.cc:5450
      #12 0x000057842c323519 in handle_select (thd=thd@entry=0x706944000c68, lex=lex@entry=0x706944004fd0, result=result@entry=0x706944018e10, setup_tables_done_option=setup_tables_done_option@entry=0)at /test/12.2_opt/sql/sql_select.cc:636
      #13 0x000057842c2edb29 in execute_sqlcom_select (thd=thd@entry=0x706944000c68, all_tables=0x706944017da8) at /test/12.2_opt/sql/sql_parse.cc:6171
      #14 0x000057842c2ec647 in mysql_execute_command (thd=thd@entry=0x706944000c68, is_called_from_prepared_stmt=false) at /test/12.2_opt/sql/sql_parse.cc:3951
      #15 0x000057842c2e47e4 in mysql_parse (thd=thd@entry=0x706944000c68, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x706a747fe420)at /test/12.2_opt/sql/sql_parse.cc:7888
      #16 0x000057842c2e2f8a in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x706944000c68, packet=packet@entry=0x706944008a39 "", packet_length=packet_length@entry=15, blocking=true)at /test/12.2_opt/sql/sql_parse.cc:1878
      #17 0x000057842c2e4c61 in do_command (thd=thd@entry=0x706944000c68, blocking=true) at /test/12.2_opt/sql/sql_parse.cc:1417
      #18 0x000057842c43898d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x57842f90f6b8, put_in_cache=true)at /test/12.2_opt/sql/sql_connect.cc:1503
      #19 0x000057842c43874f in handle_one_connection (arg=arg@entry=0x57842f90f6b8)at /test/12.2_opt/sql/sql_connect.cc:1415
      #20 0x000057842c5fcf09 in pfs_spawn_thread (arg=0x57842f95e0f8)at /test/12.2_opt/storage/perfschema/pfs.cc:2198
      #21 0x0000706a7629ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #22 0x0000706a76329c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      CS 12.2.0 fd15fd2765b53d0c070dd01d86fb231024b8f284 (Debug, Clang 21.1.3-20250923) Build 10/11/2025

      Core was generated by `/test/MD101125-mariadb-12.2.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x0000794e85591456 in DTVAL::FormatValue (this=0x794d7be00e98, vp=0x794d7be00878, fmt=0x794e8549d8c2 "%Y-%m-%d")at /test/12.2_dbg/storage/connect/value.cpp:2874
       
      [Current thread is 1 (LWP 3978743)]
      (gdb) bt
      #0  0x0000794e85591456 in DTVAL::FormatValue (this=0x794d7be00e98, vp=0x794d7be00878, fmt=0x794e8549d8c2 "%Y-%m-%d")at /test/12.2_dbg/storage/connect/value.cpp:2874
      #1  0x0000794e854f0322 in ha_connect::MakeRecord (this=0x794d80047f88, buf=0x794d80035d92 "") at /test/12.2_dbg/storage/connect/ha_connect.cc:2239
      #2  0x0000794e854f62c8 in ha_connect::ReadIndexed (this=0x794d80047f88, buf=0x794d80035d92 "", op=OP_FIRST, kr=0x0)at /test/12.2_dbg/storage/connect/ha_connect.cc:3882
      #3  0x0000794e854f67d7 in ha_connect::index_first (this=0x794d80047f88, buf=0x794d80035d92 "") at /test/12.2_dbg/storage/connect/ha_connect.cc:4019
      #4  0x00005d21dd26d7b4 in handler::ha_index_first (this=0x794d80047f88, buf=0x794d80035d92 "") at /test/12.2_dbg/sql/handler.cc:3999
      #5  0x00005d21ddb54e72 in ha_partition::handle_ordered_index_scan (this=0x794d80047688, buf=0x794d80049358 "\377", reverse_order=false)at /test/12.2_dbg/sql/ha_partition.cc:8021
      #6  0x00005d21ddb55597 in ha_partition::common_first_last (this=0x794d80047688, buf=0x794d80049358 "\377")at /test/12.2_dbg/sql/ha_partition.cc:6194
      #7  0x00005d21ddb554d4 in ha_partition::index_first (this=0x794d80047688, buf=0x794d80049358 "\377") at /test/12.2_dbg/sql/ha_partition.cc:6135
      #8  0x00005d21dd26d7b4 in handler::ha_index_first (this=0x794d80047688, buf=0x794d80049358 "\377") at /test/12.2_dbg/sql/handler.cc:3999
      #9  0x00005d21dd781dfa in join_read_first (tab=0x794d8001d040)at /test/12.2_dbg/sql/sql_select.cc:25701
      #10 0x00005d21dd73085f in sub_select (join=0x794d8001b638, join_tab=0x794d8001d040, end_of_records=false)at /test/12.2_dbg/sql/sql_select.cc:24554
      #11 0x00005d21dd7546de in do_select (join=0x794d8001b638, procedure=0x0)at /test/12.2_dbg/sql/sql_select.cc:24068
      #12 0x00005d21dd753bc6 in JOIN::exec_inner (this=0x794d8001b638)at /test/12.2_dbg/sql/sql_select.cc:5134
      #13 0x00005d21dd752ee3 in JOIN::exec (this=0x794d8001b638)at /test/12.2_dbg/sql/sql_select.cc:4922
      #14 0x00005d21dd731113 in mysql_select (thd=0x794d80000d58, tables=0x794d8001a5a8, fields=@0x794d8001a210: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x794d8001a558, last = 0x794d8001c090, elements = 2}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2166622976, result=0x794d8001b610, unit=0x794d80005178, select_lex=0x794d80019f58) at /test/12.2_dbg/sql/sql_select.cc:5450
      #15 0x00005d21dd730c0d in handle_select (thd=0x794d80000d58, lex=0x794d80005098, result=0x794d8001b610, setup_tables_done_option=0)at /test/12.2_dbg/sql/sql_select.cc:636
      #16 0x00005d21dd6dc93a in execute_sqlcom_select (thd=0x794d80000d58, all_tables=0x794d8001a5a8) at /test/12.2_dbg/sql/sql_parse.cc:6171
      #17 0x00005d21dd6d2db3 in mysql_execute_command (thd=0x794d80000d58, is_called_from_prepared_stmt=false) at /test/12.2_dbg/sql/sql_parse.cc:3951
      #18 0x00005d21dd6cbcf8 in mysql_parse (thd=0x794d80000d58, rawbuf=0x794d80019ee0 "SELECT * FROM t", length=15, parser_state=0x794ecc531a00) at /test/12.2_dbg/sql/sql_parse.cc:7888
      #19 0x00005d21dd6c94d9 in dispatch_command (command=COM_QUERY, thd=0x794d80000d58, packet=0x794d8000b239 "", packet_length=15, blocking=true) at /test/12.2_dbg/sql/sql_parse.cc:1878
      #20 0x00005d21dd6cc77a in do_command (thd=0x794d80000d58, blocking=true)at /test/12.2_dbg/sql/sql_parse.cc:1417
      #21 0x00005d21dd8bfafe in do_handle_one_connection (connect=0x5d21dfe5e088, put_in_cache=true) at /test/12.2_dbg/sql/sql_connect.cc:1503
      #22 0x00005d21dd8bf8e1 in handle_one_connection (arg=0x5d21dfd9d868)at /test/12.2_dbg/sql/sql_connect.cc:1415
      #23 0x0000794ecf69ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #24 0x0000794ecf729c3c 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  101125  759e3523e3d832b174cf0a612704da38b2557b40  SIGSEGV|DTVAL::FormatValue|ha_connect::MakeRecord|ha_connect::ReadIndexed|ha_connect::index_first
      CS  10.6   opt  101125  759e3523e3d832b174cf0a612704da38b2557b40  SIGSEGV|DTVAL::FormatValue|ha_connect::MakeRecord|ha_connect::ReadIndexed|handler::ha_index_first
      CS  10.11  dbg  101125  536cd151f0370216d9ba4c15f40c7037060972a5  SIGSEGV|DTVAL::FormatValue|ha_connect::MakeRecord|ha_connect::ReadIndexed|ha_connect::index_first
      CS  10.11  opt  101125  536cd151f0370216d9ba4c15f40c7037060972a5  SIGSEGV|DTVAL::FormatValue|ha_connect::MakeRecord|ha_connect::ReadIndexed|handler::ha_index_first
      CS  11.4   dbg  101125  a1bb5c94fda453baa99e57e3927eaa7cd3c8bafe  SIGSEGV|DTVAL::FormatValue|ha_connect::MakeRecord|ha_connect::ReadIndexed|ha_connect::index_first
      CS  11.4   opt  101125  a1bb5c94fda453baa99e57e3927eaa7cd3c8bafe  SIGSEGV|DTVAL::FormatValue|ha_connect::MakeRecord|ha_connect::ReadIndexed|handler::ha_index_first
      CS  11.8   dbg  101125  e0428264d0095472c015eb58c46be68ca1a320ee  SIGSEGV|DTVAL::FormatValue|ha_connect::MakeRecord|ha_connect::ReadIndexed|ha_connect::index_first
      CS  11.8   opt  101125  e0428264d0095472c015eb58c46be68ca1a320ee  SIGSEGV|DTVAL::FormatValue|ha_connect::MakeRecord|ha_connect::ReadIndexed|handler::ha_index_first
      CS  12.1   dbg  101125  ba00960fdaee67a4efff6866e31f446bf486a1c2  SIGSEGV|DTVAL::FormatValue|ha_connect::MakeRecord|ha_connect::ReadIndexed|ha_connect::index_first
      CS  12.1   opt  101125  ba00960fdaee67a4efff6866e31f446bf486a1c2  SIGSEGV|DTVAL::FormatValue|ha_connect::MakeRecord|ha_connect::ReadIndexed|handler::ha_index_first
      CS  12.2   dbg  101125  fd15fd2765b53d0c070dd01d86fb231024b8f284  SIGSEGV|DTVAL::FormatValue|ha_connect::MakeRecord|ha_connect::ReadIndexed|ha_connect::index_first
      CS  12.2   opt  101125  fd15fd2765b53d0c070dd01d86fb231024b8f284  SIGSEGV|DTVAL::FormatValue|ha_connect::MakeRecord|ha_connect::ReadIndexed|handler::ha_index_first
      ES  10.6   dbg  101125  f0d4d34fb0314b03fddb71fb9dbde372744a8c13  SIGSEGV|DTVAL::FormatValue|ha_connect::MakeRecord|ha_connect::ReadIndexed|ha_connect::index_first
      ES  10.6   opt  101125  f0d4d34fb0314b03fddb71fb9dbde372744a8c13  SIGSEGV|DTVAL::FormatValue|ha_connect::MakeRecord|ha_connect::ReadIndexed|handler::ha_index_first
      ES  11.4   dbg  101125  b81ec4b57a5ddce88b8e2b2d16b64625ffdaa0e6  SIGSEGV|DTVAL::FormatValue|ha_connect::MakeRecord|ha_connect::ReadIndexed|ha_connect::index_first
      ES  11.4   opt  101125  b81ec4b57a5ddce88b8e2b2d16b64625ffdaa0e6  SIGSEGV|DTVAL::FormatValue|ha_connect::MakeRecord|ha_connect::ReadIndexed|handler::ha_index_first
      ES  11.8   dbg  101125  db36e8fb3bcdae26dd0acdcb2b52f7f4eb014df6  SIGSEGV|DTVAL::FormatValue|ha_connect::MakeRecord|ha_connect::ReadIndexed|ha_connect::index_first
      ES  11.8   opt  101125  db36e8fb3bcdae26dd0acdcb2b52f7f4eb014df6  SIGSEGV|DTVAL::FormatValue|ha_connect::MakeRecord|ha_connect::ReadIndexed|handler::ha_index_first
      

      No UBSAN/ASAN issues observed. SAN builds SIGSEGV in the same way.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.