From bc89387e3d9cf32603213ca26bdfe3df1dd9c526 Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Fri, 15 Dec 2017 21:16:24 +0000 Subject: only run pstack once * otherwise, any useful information is likely to be overwritten when very large processes take some time to exit --- configd/src/apps/sentinel/service.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configd/src/apps/sentinel/service.cpp b/configd/src/apps/sentinel/service.cpp index 3c762a957ec..5633c356bc7 100644 --- a/configd/src/apps/sentinel/service.cpp +++ b/configd/src/apps/sentinel/service.cpp @@ -113,8 +113,7 @@ Service::terminate(bool catchable, bool dumpState) ret == 0 ? "OK" : strerror(errno)); return ret; } else { - setState(KILLING); - if (dumpState) { + if (dumpState && _state != KILLING) { vespalib::string pstackCmd = make_string("pstack %d > %s/%s.pstack.%d", _pid, getVespaTempDir().c_str(), name().c_str(), _pid); LOG(info, "%s:%d failed to stop. Stack dumped at %s", name().c_str(), _pid, pstackCmd.c_str()); @@ -123,6 +122,7 @@ Service::terminate(bool catchable, bool dumpState) LOG(warning, "'%s' failed with return value %d", pstackCmd.c_str(), pstackRet); } } + setState(KILLING); kill(_pid, SIGCONT); // if it was stopped for some reason int ret = kill(_pid, SIGKILL); LOG(debug, "%s: kill -SIGKILL %d: %s", name().c_str(), (int)_pid, -- cgit v1.2.3