You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "alexandre parenteau (JIRA)" <ji...@apache.org> on 2012/05/17 01:11:06 UTC

[jira] [Created] (THRIFT-1606) Race condition in BoostThreadFactory.cpp

alexandre parenteau created THRIFT-1606:
-------------------------------------------

             Summary: Race condition in BoostThreadFactory.cpp
                 Key: THRIFT-1606
                 URL: https://issues.apache.org/jira/browse/THRIFT-1606
             Project: Thrift
          Issue Type: Bug
          Components: C++ - Library
    Affects Versions: 0.8, 0.9
         Environment: Debian, Redhat, Windows
            Reporter: alexandre parenteau
             Fix For: 0.8


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)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Closed] (THRIFT-1606) Race condition in BoostThreadFactory.cpp

Posted by "Jake Farrell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1606?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jake Farrell closed THRIFT-1606.
--------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 0.8)
                   0.9
         Assignee: alexandre parenteau

Thanks for the patch, committed
                
> Race condition in BoostThreadFactory.cpp
> ----------------------------------------
>
>                 Key: THRIFT-1606
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1606
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.8, 0.9
>         Environment: Debian, Redhat, Windows
>            Reporter: alexandre parenteau
>            Assignee: alexandre parenteau
>              Labels: patch
>             Fix For: 0.9
>
>         Attachments: THRIFT-1606.patch.txt
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 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)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (THRIFT-1606) Race condition in BoostThreadFactory.cpp

Posted by "alexandre parenteau (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1606?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

alexandre parenteau updated THRIFT-1606:
----------------------------------------

    Attachment: THRIFT-1606.patch.txt

Patch against current 0.8.x
                
> Race condition in BoostThreadFactory.cpp
> ----------------------------------------
>
>                 Key: THRIFT-1606
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1606
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.8, 0.9
>         Environment: Debian, Redhat, Windows
>            Reporter: alexandre parenteau
>              Labels: patch
>             Fix For: 0.8
>
>         Attachments: THRIFT-1606.patch.txt
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 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)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1606) Race condition in BoostThreadFactory.cpp

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1606?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13277572#comment-13277572 ] 

Hudson commented on THRIFT-1606:
--------------------------------

Integrated in Thrift #470 (See [https://builds.apache.org/job/Thrift/470/])
    Thrift-1606:Race condition in BoostThreadFactory.cpp
Client: cpp
Patch: alexandre parenteau

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. (Revision 1339477)

     Result = SUCCESS
                
> Race condition in BoostThreadFactory.cpp
> ----------------------------------------
>
>                 Key: THRIFT-1606
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1606
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.8, 0.9
>         Environment: Debian, Redhat, Windows
>            Reporter: alexandre parenteau
>            Assignee: alexandre parenteau
>              Labels: patch
>             Fix For: 0.9
>
>         Attachments: THRIFT-1606.patch.txt
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 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)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira