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

emb_free_embedded_thd is not thread safe

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 5.5.33
    • Fix Version/s: 5.5.34
    • Component/s: None
    • Labels:
      None

      Description

      static void emb_free_embedded_thd(MYSQL *mysql)
      {
      THD thd= (THD)mysql->thd;
      thd->clear_data_list();
      thread_count--;
      thd->store_globals();
      thd->unlink();
      delete thd;
      my_pthread_setspecific_ptr(THR_THD, 0);
      mysql->thd=0;
      }

      thread_count is global but it is modified without protection. In a multi-core env this will lead to lost updates or at least, race conditions.

        Attachments

          Activity

            People

            Assignee:
            holyfoot Alexey Botchkov
            Reporter:
            vilho Vilho Raatikka
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: