From d66dfa2b32a7f4b737acef67f1060ceb10faaa47 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Wed, 19 Oct 2016 13:01:39 -0400 Subject: [PATCH] rgw: dump remaining coroutines when cr deadlock is detected Signed-off-by: Casey Bodley --- src/rgw/rgw_coroutine.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_coroutine.cc b/src/rgw/rgw_coroutine.cc index 7cebd27e5587d..8f97eac3e7883 100644 --- a/src/rgw/rgw_coroutine.cc +++ b/src/rgw/rgw_coroutine.cc @@ -588,7 +588,19 @@ int RGWCoroutinesManager::run(list& stacks) } lock.get_write(); - assert(context_stacks.empty() || going_down.read()); // assert on deadlock + if (!context_stacks.empty() && !going_down.read()) { + JSONFormatter formatter(true); + formatter.open_array_section("context_stacks"); + for (auto& s : context_stacks) { + ::encode_json("entry", *s, &formatter); + } + formatter.close_section(); + lderr(cct) << __func__ << "(): ERROR: deadlock detected, dumping remaining coroutines:\n"; + formatter.flush(*_dout); + *_dout << dendl; + assert(context_stacks.empty() || going_down.read()); // assert on deadlock + } + for (auto stack : context_stacks) { ldout(cct, 20) << "clearing stack on run() exit: stack=" << (void *)stack << " nref=" << stack->get_nref() << dendl; stack->put(); -- 2.47.3