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

table_share used for reading statistical tables is not protected

    XMLWordPrintable

Details

    Description

      While reading statistics for a table in function read_statistics_for_table_is_needed we don't protect the table_share fields and there is a chance that multiple threads would try to access it at the same time.

      To see this
      Lets add this patch to read_statistics_for_table

      +fprintf(stderr, "READ %p\n", current_thd); fflush(stderr);
      +sleep(10);
      +fprintf(stderr, "DONE %p\n", current_thd); fflush(stderr);
      +
      

      and the server output is

       
      READ 0x7fc870000b00 
      READ 0x7fc874000b00
      DONE 0x7fc870000b00
      DONE 0x7fc874000b00
      

      so different threads are entering the function at the same time.
      So i think we need an exclusive lock to protect the members of table_share

      Attachments

        Issue Links

          Activity

            People

              svoj Sergey Vojtovich
              varun Varun Gupta (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              8 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.