Project

General

Profile

Actions

Bug #12444

closed

WorkQueue.cc: unintended behavior for ThreadPool::drain()?

Added by Krzysztof Kosinski almost 9 years ago. Updated almost 7 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
Category:
-
Target version:
-
% Done:

0%

Source:
other
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

ThreadPool::drain() contains this condition:

while (processing || (wq != NULL && !wq->_empty()))
  _wait_cond.Wait(_lock);

This will wait until no threads are processing (which only happens when all queues are empty), AND the queue given by wq is empty (if wq is not NULL). However, as far as I can tell, the intent of the API seems to be that drain(wq) should only wait until the queue given in the parameter is empty, since otherwise passing a work queue which is already added to the thread pool (as seen in e.g. WorkQueue::drain()) is equivalent to passing NULL. Therefore the correct condition seems to be:

while (processing && (wq == NULL || wq->_empty()))
  _wait_cond.Wait(_lock);

Am I missing something here?

Actions

Also available in: Atom PDF