Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1606

Race condition in BoostThreadFactory.cpp

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.8, 0.9
    • 0.9
    • C++ - Library
    • Debian, Redhat, Windows

    • Patch Available

    Description

      During deployment, we noticed a bug inside the new (optional) boost thread replacement of pthread.

      It moves the line:

      state_ = starting;

      from after the creation of the boost::thread to immediately before it. The bug was that one of the first pieces of threadMain (the thread routine of the thread being created) is:

      if (thread->state_ != starting)

      { return (void*)0; }

      So there was a race condition between the line that set state_ to "starting", and the line that checked to make sure that it was "starting". That ended meaning that sometimes calling "start()" would not result in the thread's runnable being called.

      Testing: this was tested in production, but NOT with thrift test suite (however I believe ./configure --enable_boostthreads and testing will cover this)

      Attachments

        1. THRIFT-1606.patch.txt
          0.6 kB
          alexandre parenteau

        Activity

          People

            aubonbeurre alexandre parenteau
            aubonbeurre alexandre parenteau
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified