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

Several performance_schema tests fail due to explicit (too small for ASAN) thread_stack

    XMLWordPrintable

Details

    Description

      Recent versions of GCC and clang require much larger thread stack size when the server is built with -DWITH_ASAN=ON. This is by design, and a good thing, because it will allow more stack buffer overflows to be caught.

      A number of tests in ./mtr --suite=perfschema are explicitly specifying thread_stack=655360, which usually is more than twice the DEFAULT_THREAD_STACK that is defined in include/my_pthread.h. However, the minimum for ASAN instrumented builds can be as large as 11 megabytes (more than 10 times this size).

      The following patch would prevent server startup failures in a number of tests when I use cmake -DWITH_ASAN=ON on clang 16.0.6:

      diff --git a/mysql-test/suite/perfschema/t/max_program_zero-master.opt b/mysql-test/suite/perfschema/t/max_program_zero-master.opt
      index 7803f9c5e1b..7e5af1a2e3a 100644
      --- a/mysql-test/suite/perfschema/t/max_program_zero-master.opt
      +++ b/mysql-test/suite/perfschema/t/max_program_zero-master.opt
      @@ -1,3 +1,2 @@
       --loose-performance_schema_max_program_instances=0
       --loose-performance_schema_max_statement_stack=1
      ---thread_stack=655360
      diff --git a/mysql-test/suite/perfschema/t/start_server_low_digest_sql_length-master.opt b/mysql-test/suite/perfschema/t/start_server_low_digest_sql_length-master.opt
      index e6483c360f9..0e7696ccaca 100644
      --- a/mysql-test/suite/perfschema/t/start_server_low_digest_sql_length-master.opt
      +++ b/mysql-test/suite/perfschema/t/start_server_low_digest_sql_length-master.opt
      @@ -1,3 +1,2 @@
      ---thread_stack=655360
       --max_digest_length=10
       --loose-performance_schema_max_sql_text_length=10
      diff --git a/mysql-test/suite/perfschema/t/start_server_zero_digest_sql_length-master.opt b/mysql-test/suite/perfschema/t/start_server_zero_digest_sql_length-master.opt
      index 5ee2230e539..5ddf5d8caae 100644
      --- a/mysql-test/suite/perfschema/t/start_server_zero_digest_sql_length-master.opt
      +++ b/mysql-test/suite/perfschema/t/start_server_zero_digest_sql_length-master.opt
      @@ -1,3 +1,2 @@
      ---thread_stack=655360
       --max_digest_length=0
       --loose-performance_schema_max_sql_text_length=0
      diff --git a/mysql-test/suite/perfschema/t/statement_digest_long_query-master.opt b/mysql-test/suite/perfschema/t/statement_digest_long_query-master.opt
      deleted file mode 100644
      index 3f9d7900961..00000000000
      --- a/mysql-test/suite/perfschema/t/statement_digest_long_query-master.opt
      +++ /dev/null
      @@ -1 +0,0 @@
      ---thread_stack=655360
      diff --git a/mysql-test/suite/perfschema/t/statement_program_concurrency-master.opt b/mysql-test/suite/perfschema/t/statement_program_concurrency-master.opt
      index 8c0dedeeb17..df5d7b1b706 100644
      --- a/mysql-test/suite/perfschema/t/statement_program_concurrency-master.opt
      +++ b/mysql-test/suite/perfschema/t/statement_program_concurrency-master.opt
      @@ -1 +1 @@
      ---innodb_lock_wait_timeout=1 --thread_stack=655360
      +--innodb_lock_wait_timeout=0
      diff --git a/mysql-test/suite/perfschema/t/statement_program_lost_inst-master.opt b/mysql-test/suite/perfschema/t/statement_program_lost_inst-master.opt
      index 699c91930ae..0744e09f8ae 100644
      --- a/mysql-test/suite/perfschema/t/statement_program_lost_inst-master.opt
      +++ b/mysql-test/suite/perfschema/t/statement_program_lost_inst-master.opt
      @@ -1,3 +1,3 @@
       --loose-performance_schema_max_program_instances=7
       --loose-performance_schema_max_statement_stack=2
      ---thread_stack=655360
      +--thread_stack=10485760
      diff --git a/mysql-test/suite/perfschema/t/statement_program_lost_inst.test b/mysql-test/suite/perfschema/t/statement_program_lost_inst.test
      index 023180b9d2b..fa70ec963e8 100644
      --- a/mysql-test/suite/perfschema/t/statement_program_lost_inst.test
      +++ b/mysql-test/suite/perfschema/t/statement_program_lost_inst.test
      @@ -22,7 +22,7 @@ let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
       --exec echo "wait" > $restart_file
       --shutdown_server 
       --source include/wait_until_disconnected.inc
      ---exec echo "restart:--performance_schema_max_program_instances=7 --performance_schema_max_statement_stack=2 --thread_stack=655360">$restart_file
      +--exec echo "restart:--performance_schema_max_program_instances=7 --performance_schema_max_statement_stack=2">$restart_file
       --enable_reconnect
       --source include/wait_until_connected_again.inc
       
      diff --git a/mysql-test/suite/perfschema/t/statement_program_nested-master.opt b/mysql-test/suite/perfschema/t/statement_program_nested-master.opt
      deleted file mode 100644
      index 3f9d7900961..00000000000
      --- a/mysql-test/suite/perfschema/t/statement_program_nested-master.opt
      +++ /dev/null
      @@ -1 +0,0 @@
      ---thread_stack=655360
      diff --git a/mysql-test/suite/perfschema/t/statement_program_nesting_event_check-master.opt b/mysql-test/suite/perfschema/t/statement_program_nesting_event_check-master.opt
      deleted file mode 100644
      index 3f9d7900961..00000000000
      --- a/mysql-test/suite/perfschema/t/statement_program_nesting_event_check-master.opt
      +++ /dev/null
      @@ -1 +0,0 @@
      ---thread_stack=655360
      diff --git a/mysql-test/suite/perfschema/t/statement_program_non_nested-master.opt b/mysql-test/suite/perfschema/t/statement_program_non_nested-master.opt
      deleted file mode 100644
      index 3f9d7900961..00000000000
      --- a/mysql-test/suite/perfschema/t/statement_program_non_nested-master.opt
      +++ /dev/null
      @@ -1 +0,0 @@
      ---thread_stack=655360
      

      I did not check what would happen in a build that would use the smaller DEFAULT_THREAD_STACK. The above patch is only indicating what is wrong and needs to be fixed in some way.

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              marko Marko Mäkelä
              Votes:
              1 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.