Github user jeking3 commented on a diff in the pull request:
https://github.com/apache/thrift/pull/980#discussion_r60614134
--- Diff: lib/cpp/src/thrift/concurrency/ThreadManager.cpp ---
@@ -421,7 +416,7 @@ void ThreadManager::Impl::removeWorker(size_t value) {
{
Synchronized s(workerMonitor_);
- while (workerCount_ != workerMaxCount_) {
+ while (workerCount_ > goalCount) {
--- End diff --
ThreadManager should probably be tossed out; removeWorker is inherently
dangerous for a variety of reasons just like this. In particular I can see a
scenario where multiple workers simultaneously try to reduce the worker count
by the same amount and fail badly because they both thought there were 5
workers and they both asked to removeWorker(3). The API would be much better
as specifying what the new limit should be and the reduction of intention vs
setting a barrier until you get there should be separate operations. It seems
pretty fragile as-is and I think the whole thing needs a rethink.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---