diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-08-11 16:36:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-11 16:36:47 +0200 |
commit | 51837baa13eb0a1f67c3e4f4613b71b8d90b0017 (patch) | |
tree | 8dfd1bf5209944b13d288aa0920fcf5a4f489679 | |
parent | 209b4fe40b8575c9e25eee2f1ef9d024fef3cabe (diff) | |
parent | 69e7d3ceb2b18edc8c455205ecbd203d3b38df0b (diff) |
Merge pull request #3084 from vespa-engine/balder/pstack-before-hard-kill
Dump the stack if some processes will not shut down.
-rw-r--r-- | configd/src/apps/sentinel/service.cpp | 22 | ||||
-rwxr-xr-x | vespabase/src/rhel-prestart.sh | 1 |
2 files changed, 19 insertions, 4 deletions
diff --git a/configd/src/apps/sentinel/service.cpp b/configd/src/apps/sentinel/service.cpp index 78aa618f01f..90a88931c14 100644 --- a/configd/src/apps/sentinel/service.cpp +++ b/configd/src/apps/sentinel/service.cpp @@ -15,9 +15,17 @@ LOG_SETUP(".service", "$Id$"); extern sig_atomic_t stop; -namespace config { -namespace sentinel { +namespace config::sentinel { +namespace { + +std::string getVespaTempDir() { + std::string tmp = getenv("ROOT"); + tmp += "/var/db/vespa/tmp"; + return tmp; +} + +} Service::Service(const SentinelConfig::Service& service, const SentinelConfig::Application& application, std::list<OutputConnection *> &ocs, StartMetrics &metrics) @@ -99,6 +107,13 @@ Service::terminate(bool catchable) return ret; } else { setState(KILLING); + char pstackCmd[256]; + LOG(info, "%s:%d failed to stop. Will dump the stack", name().c_str(), _pid); + snprintf(pstackCmd, sizeof(pstackCmd), "pstack %d > %s/%s.pstack.%d", _pid, getVespaTempDir().c_str(), name().c_str(), _pid); + int pstackRet = system(pstackCmd); + if (pstackRet != 0) { + LOG(warning, "'%s' failed with return value %d", pstackCmd, pstackRet); + } 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, @@ -427,6 +442,5 @@ Service::stateName(ServiceState state) const return "--BAD--"; } +} -} // end namespace sentinel -} // end namespace config diff --git a/vespabase/src/rhel-prestart.sh b/vespabase/src/rhel-prestart.sh index b6444c37548..069a41235b2 100755 --- a/vespabase/src/rhel-prestart.sh +++ b/vespabase/src/rhel-prestart.sh @@ -91,6 +91,7 @@ fixdir ${VESPA_USER} wheel 755 logs/vespa/qrs fixdir ${VESPA_USER} wheel 755 logs/vespa/search fixdir ${VESPA_USER} wheel 755 var/cache/vespa/config fixdir ${VESPA_USER} wheel 755 var/db/vespa +fixdir ${VESPA_USER} wheel 755 var/db/vespa/tmp fixdir ${VESPA_USER} wheel 755 var/db/vespa/config_server fixdir ${VESPA_USER} wheel 755 var/db/vespa/config_server/serverdb fixdir ${VESPA_USER} wheel 755 var/db/vespa/config_server/serverdb/applications |