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

Server null-pointer crash at startup when tmptables left in --tmpdir

Details

    Description

      When the server starts up it looks in --tmpdir for leftover .FRM files from temporary tables (eg. from a prior crash). After the latest release, if any such .frm files are found and opened successfully, the server will crash on nullpointer access and will not be able to start until the .frm files have been manually removed from --tmpdir or the server downgraded to an earlier release without the problem.

      The bug is introduced with this patch from MDEV-35840:

      commit 78157c4765f2c086fabe183d51d7734ecffdbdd8
      Author: Yuchen Pei <ycp@mariadb.com>
      Date:   Tue Jan 14 17:47:08 2025 +1100
       
          MDEV-35840 Eliminate -warray-bounds triggered by TABLE_SHARE::db_type()
       
          The warnings are triggered with -O3
      

      diff --git a/sql/sql_base.cc b/sql/sql_base.cc
      index 5c03ba3d42d..aaa86e7bfa0 100644
      --- a/sql/sql_base.cc
      +++ b/sql/sql_base.cc
      @@ -8953,8 +8953,9 @@ my_bool mysql_rm_tmp_tables(void)
                 memcpy(path_copy, path, path_len - ext_len);
                 path_copy[path_len - ext_len]= 0;
                 init_tmp_table_share(thd, &share, "", 0, "", path_copy);
      +          handlerton *ht= share.db_type();
                 if (!open_table_def(thd, &share))
      -            share.db_type()->drop_table(share.db_type(), path_copy);
      +            ht->drop_table(share.db_type(), path_copy);
                 free_table_share(&share);
               }
               /*
      

      The share.db_type() is set by the call to open_table_def(), so after the patch the ht will always be NULL and the code will crash whenever open_table_def() returns 0.

      This regression is quite severe as it leaves the server in a state where it cannot be started and with no indication to the user what is needed to resolve the problem. So the fix will need to go into 10.5.

      Attachments

        Issue Links

          Activity

            knielsen Kristian Nielsen created issue -
            knielsen Kristian Nielsen made changes -
            Field Original Value New Value
            elenst Elena Stepanova made changes -
            Assignee Yuchen Pei [ JIRAUSER52627 ]
            serg Sergei Golubchik made changes -
            Labels regression
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            Priority Critical [ 2 ] Blocker [ 1 ]
            ycp Yuchen Pei made changes -
            Status Open [ 1 ] Confirmed [ 10101 ]
            ycp Yuchen Pei made changes -
            ycp Yuchen Pei made changes -
            Assignee Yuchen Pei [ JIRAUSER52627 ] Sergei Golubchik [ serg ]
            Status Confirmed [ 10101 ] In Review [ 10002 ]
            ycp Yuchen Pei made changes -
            ycp Yuchen Pei made changes -
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ] Yuchen Pei [ JIRAUSER52627 ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            ycp Yuchen Pei made changes -
            Component/s Server [ 13907 ]
            Fix Version/s 10.5.29 [ 29996 ]
            Fix Version/s 10.5 [ 23123 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            JIraAutomate JiraAutomate made changes -
            Fix Version/s 10.6.22 [ 29997 ]
            Fix Version/s 10.11.12 [ 29998 ]
            Fix Version/s 11.4.6 [ 29999 ]
            Fix Version/s 11.8.2 [ 30001 ]

            People

              ycp Yuchen Pei
              knielsen Kristian Nielsen
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.