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

SIGSEGV in FIFO_Queue<PROF_MEASUREMENT>::pop and in FIFO_Queue<QUERY_PROFILE>::pop on CREATE/INSERT

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      I am seeing two highly sporadic stacks in FIFO_Queue (sql/sql_profile.h) in bb-12.2-serg optimized builds:

      MDEV-37833 CS 12.2.0 fc5dd463df41ebc4c9aa53605323ef3be563d899 (Optimized, Clang 21.1.3-20250923) Build 01/11/2025

      Core was generated by `/test/MDEV-37833_MD011125-mariadb-12.2.0-linux-x86_64-opt/bin/mariadbd --no-def'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  FIFO_Queue<PROF_MEASUREMENT>::pop (this=0x74034bd62c30)at /test/bb-12.2-serg_opt/sql/sql_profile.h:138
       
      [Current thread is 1 (LWP 2265595)]
      (gdb) bt
      #0  FIFO_Queue<PROF_MEASUREMENT>::pop (this=0x74034bd62c30)at /test/bb-12.2-serg_opt/sql/sql_profile.h:138
      #1  QUERY_PROFILE::~QUERY_PROFILE (this=this@entry=0x74034bd62c00)at /test/bb-12.2-serg_opt/sql/sql_profile.cc:281
      #2  0x000063c30675a590 in PROFILING::finish_current_query_impl (this=0x740588004a08) at /test/bb-12.2-serg_opt/sql/sql_profile.cc:395
      #3  0x000063c3066008d3 in PROFILING::finish_current_query (this=0x7402d2cb1a18)at /test/bb-12.2-serg_opt/sql/sql_profile.h:313
      #4  dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x740588000c68, packet=<optimized out>, packet@entry=0x7402d24dbc39 "", packet_length=packet_length@entry=64, blocking=<optimized out>) at /test/bb-12.2-serg_opt/sql/sql_parse.cc:2481
      #5  0x000063c306601671 in do_command (thd=thd@entry=0x740588000c68, blocking=true) at /test/bb-12.2-serg_opt/sql/sql_parse.cc:1417
      #6  0x000063c30675650d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x63c3099986a8, put_in_cache=true)at /test/bb-12.2-serg_opt/sql/sql_connect.cc:1414
      #7  0x000063c3067562cf in handle_one_connection (arg=arg@entry=0x63c3099986a8)at /test/bb-12.2-serg_opt/sql/sql_connect.cc:1326
      #8  0x000063c30691c3e9 in pfs_spawn_thread (arg=0x63c30993b8b8)at /test/bb-12.2-serg_opt/storage/perfschema/pfs.cc:2198
      #9  0x00007406d789ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #10 0x00007406d7929c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      And:

      MDEV-37833 CS 12.2.0 fc5dd463df41ebc4c9aa53605323ef3be563d899 (Optimized, Clang 21.1.3-20250923) Build 01/11/2025

      Core was generated by `/test/MDEV-37833_MD011125-mariadb-12.2.0-linux-x86_64-opt/bin/mariadbd --no-def'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  FIFO_Queue<QUERY_PROFILE>::pop (this=0x769f4c004a30)at /test/bb-12.2-serg_opt/sql/sql_profile.h:138
       
      [Current thread is 1 (LWP 3926651)]
      (gdb) bt
      #0  FIFO_Queue<QUERY_PROFILE>::pop (this=0x769f4c004a30)at /test/bb-12.2-serg_opt/sql/sql_profile.h:138
      #1  PROFILING::finish_current_query_impl (this=0x769f4c004a08)at /test/bb-12.2-serg_opt/sql/sql_profile.cc:395
      #2  0x000058644590c8d3 in PROFILING::finish_current_query (this=0x769f4dc90428)at /test/bb-12.2-serg_opt/sql/sql_profile.h:313
      #3  dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x769f4c000c68, packet=<optimized out>, packet@entry=0x769f4cf3eee9 "", packet_length=packet_length@entry=16, blocking=<optimized out>) at /test/bb-12.2-serg_opt/sql/sql_parse.cc:2481
      #4  0x000058644590d671 in do_command (thd=thd@entry=0x769f4c000c68, blocking=true) at /test/bb-12.2-serg_opt/sql/sql_parse.cc:1417
      #5  0x0000586445a6250d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x586447a3c6a8, put_in_cache=true)at /test/bb-12.2-serg_opt/sql/sql_connect.cc:1414
      #6  0x0000586445a622cf in handle_one_connection (arg=arg@entry=0x586447a3c6a8)at /test/bb-12.2-serg_opt/sql/sql_connect.cc:1326
      #7  0x0000586445c283e9 in pfs_spawn_thread (arg=0x5864479df8b8)at /test/bb-12.2-serg_opt/storage/perfschema/pfs.cc:2198
      #8  0x000076a0de49ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #9  0x000076a0de529c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Given their high sporadicity, testcase reduction has been very slow. The shortest testcase for one of them is still >1500 lines after a week of reducing. The others are 120k/160k respectively (1st stack was observed twice, 2nd stack once).

      For the SIGSEGV in FIFO_Queue<PROF_MEASUREMENT>::pop both occurences were likely on CREATE TABLE:

      CREATE TABLE `£Ô£´a` (`£Ã£±` char(1) PRIMARY KEY) DEFAULT CHARSET = ucs2 engine = RocksDB;
      

      CREATE TABLE t1 (c1 DATETIME) ENGINE=RocksDB PARTITION BY RANGE COLUMNS(c1) (PARTITION p1 VALUES LESS THAN ('2026-01-01 00:00:00'), PARTITION p2 VALUES LESS THAN ('2027-01-01 00:00:00'));
      

      Whereas the SIGSEGV in FIFO_Queue<QUERY_PROFILE>::pop was likely on INSERT:

      INSERT INTO t1 VALUES (3);
      

      And it looks like this t1 table was a MyISAM partitioned table:

      CREATE TABLE t1 (c1 INT NOT NULL) ENGINE=MyISAM PARTITION BY HASH(c1) PARTITIONS 8;
      

      Attachments

        Issue Links

          Activity

            People

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