Skip to content

Commit

Permalink
msg/DispatchQueue: clear queue after wait()
Browse files Browse the repository at this point in the history
We can have a sequence like

 - put several things in mqueue
 - call stop(), which makes thread exit without processing all items
 - wait() waits for thread to exit

...and have items left in the queue.  Throw them out on wait() (which is
called post-shutdown()).

Fixes: http://tracker.ceph.com/issues/18351
Signed-off-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Feb 8, 2018
1 parent 7a57771 commit 087a314
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/msg/DispatchQueue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,13 @@ void DispatchQueue::wait()
{
local_delivery_thread.join();
dispatch_thread.join();

// ok, clear it out
lock.Lock();
while (!mqueue.empty()) {
QueueItem i = mqueue.dequeue();
}
lock.Unlock();
}

void DispatchQueue::discard_local()
Expand Down

0 comments on commit 087a314

Please sign in to comment.