GitHub user jeking3 opened a pull request: https://github.com/apache/thrift/pull/1343
THRIFT-4106: fix errors concurrency_test was identifying I found a serious issue hiding in the thread implementation which was exposed by some of the tests. In particular, tests that use detached threads will typically construct a shared_ptr<Runnable> followed by a shared_ptr<Thread>, and then make a thread with a thread manager, then call start(). The stack frame ends without the caller saving off the shared pointers, so they start destructing however the thread may not have gotten far enough along to reference the Runnable yet, and you have a race. I am fixing this by ensuring thread start() does not return until the thread's state is changed to started by the C style threadMain function. I also was able to run clean with valgrind for the first time on this test. All three thread implementations were susceptible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/jeking3/thrift THRIFT-4106 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/thrift/pull/1343.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1343 ---- commit 7a41e7ede1bb295ba0452d7e0f2f0415b5cc36a1 Author: James E. King, III <jk...@apache.org> Date: 2017-09-06T17:12:02Z THRIFT-4106: fix errors concurrency_test was identifying Client: C++ ---- ---