Skip to content

Commit 5fbb9c5

Browse files
committed
msg: drain stack before stopping processors to avoid shutdown hang
`AsyncMessenger::shutdown()` called WorkerProcessor::stop() first, killing the worker threads, then queued a C_drain callback via stack->drain(). If a worker had already exited its event loop it never processed the callback, so drain.wait() blocked forever and the monitor shutdown hung for minutes. Move stack->drain() ahead of the processors->stop() loop. With the new order the workers are still alive to acknowledge the drain. Fixes: https://tracker.ceph.com/issues/71303 Signed-off-by: Nitzan Mordechai <[email protected]>
1 parent 2c1058b commit 5fbb9c5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/msg/async/AsyncMessenger.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ int AsyncMessenger::shutdown()
481481
{
482482
ldout(cct,10) << __func__ << " " << get_myaddrs() << dendl;
483483

484+
stack->drain();
484485
// done! clean up.
485486
for (auto &&p : processors)
486487
p->stop();
@@ -493,7 +494,7 @@ int AsyncMessenger::shutdown()
493494
stop_cond.notify_all();
494495
stopped = true;
495496
lock.unlock();
496-
stack->drain();
497+
497498
return 0;
498499
}
499500

0 commit comments

Comments
 (0)