[
https://issues.apache.org/jira/browse/THRIFT-2872?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Qiao Mu updated THRIFT-2872:
----------------------------
Description:
I have a TNonblockingServer running with 1 worker thread and 10 IO thread.
If there was a big task that just finished, all pending tasks might be expired.
In such case, all IO thread are waiting for maxMonitor_, but the worker won't
notify because it will remove all the tasks(all of them are expired) first and
tasks_.empty() will be true. Deadlock occurs.
The patch move the inner notify if clause out so it will notify even if all
tasks are removed for expiration.
was:
I have a TNonblockingServer running with 1 worker thread and 10 IO thread.
If there is a big task running, all pending tasks will be expired. In such
case, all IO thread are waiting for maxMonitor_, but the worker won't notify
because it will remove all the tasks(all of them are expired) first and
tasks_.empty() will be true. Deadlock occurs.
The patch move the inner notify if clause out so it will notify even if all
tasks are removed for expiration.
> ThreadManager deadlock for task expiration
> ------------------------------------------
>
> Key: THRIFT-2872
> URL: https://issues.apache.org/jira/browse/THRIFT-2872
> Project: Thrift
> Issue Type: Bug
> Components: C++ - Library
> Reporter: Qiao Mu
> Attachments: 0002-Fix-dead-lock-when-all-tasks-are-expired.patch
>
>
> I have a TNonblockingServer running with 1 worker thread and 10 IO thread.
> If there was a big task that just finished, all pending tasks might be
> expired. In such case, all IO thread are waiting for maxMonitor_, but the
> worker won't notify because it will remove all the tasks(all of them are
> expired) first and tasks_.empty() will be true. Deadlock occurs.
> The patch move the inner notify if clause out so it will notify even if all
> tasks are removed for expiration.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)