Skip to content

Commit

Permalink
msg/simple: wait dispatch_queue until all pipes closed
Browse files Browse the repository at this point in the history
Otherwise accepter may continue to accept new connection which may queue
new item.

Fixes: http://tracker.ceph.com/issues/16472
Signed-off-by: Haomai Wang <haomai@xsky.com>
  • Loading branch information
yuyuyu101 committed Jun 28, 2016
1 parent 48d1803 commit eebb758
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/msg/simple/SimpleMessenger.cc
Expand Up @@ -87,7 +87,6 @@ int SimpleMessenger::shutdown()
{
ldout(cct,10) << "shutdown " << get_myaddr() << dendl;
mark_down_all();
dispatch_queue.shutdown();

// break ref cycles on the loopback connection
local_connection->set_priv(NULL);
Expand Down Expand Up @@ -527,13 +526,6 @@ void SimpleMessenger::wait()
}
lock.Unlock();

if (dispatch_queue.is_started()) {
ldout(cct,10) << "wait: waiting for dispatch queue" << dendl;
dispatch_queue.wait();
dispatch_queue.discard_local();
ldout(cct,10) << "wait: dispatch queue is stopped" << dendl;
}

// done! clean up.
if (did_bind) {
ldout(cct,20) << "wait: stopping accepter thread" << dendl;
Expand All @@ -542,6 +534,14 @@ void SimpleMessenger::wait()
ldout(cct,20) << "wait: stopped accepter thread" << dendl;
}

dispatch_queue.shutdown();
if (dispatch_queue.is_started()) {
ldout(cct,10) << "wait: waiting for dispatch queue" << dendl;
dispatch_queue.wait();
dispatch_queue.discard_local();
ldout(cct,10) << "wait: dispatch queue is stopped" << dendl;
}

if (reaper_started) {
ldout(cct,20) << "wait: stopping reaper thread" << dendl;
lock.Lock();
Expand Down

0 comments on commit eebb758

Please sign in to comment.