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

Sig11 due to stack overflow in Item_cond::remove_eq_conds

    XMLWordPrintable

Details

    Description

      For some large queries Item_cond::remove_eq_conds() calls itself recursively end eventually runs out of stack. See attached schema and query files for repro.

      The possible workaround would be to add this code to the beginning of the function:

      if (check_stack_overrun(thd, STACK_MIN_SIZE, NULL))
      {
          *cond_value= Item::COND_FALSE;
          return (COND*) 0;
      }
      

      After such change mysqld will emit error instead of crashing:
      ERROR 1436 (HY000): Thread stack overrun: 283200 bytes used of a 299008 byte stack, and 16000 bytes needed. Use 'mysqld --thread_stack=#' to specify a bigger stack

      Would be nice to check all recursive function calls across the source base and make sure we have stack overflow guards there.

      Attachments

        1. gdb-output-276124.txt
          5.26 MB
          Yury Chaikou
        2. killme.sql
          402 kB
          Yury Chaikou
        3. schema.sql
          2 kB
          Yury Chaikou

        Issue Links

          Activity

            People

              knielsen Kristian Nielsen
              yury.chaikou Yury Chaikou
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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