You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2015/07/12 00:54:50 UTC

trafficserver git commit: crashlog: don't emit a crashlog if traffic_server is gone

Repository: trafficserver
Updated Branches:
  refs/heads/master 109ba5426 -> a2bc1d9c7


crashlog: don't emit a crashlog if traffic_server is gone


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/a2bc1d9c
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/a2bc1d9c
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/a2bc1d9c

Branch: refs/heads/master
Commit: a2bc1d9c7fcaf07b8d70ffe80006488017c6bd12
Parents: 109ba54
Author: James Peach <jp...@apache.org>
Authored: Sat Jul 11 15:54:45 2015 -0700
Committer: James Peach <jp...@apache.org>
Committed: Sat Jul 11 15:54:45 2015 -0700

----------------------------------------------------------------------
 cmd/traffic_crashlog/traffic_crashlog.cc | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2bc1d9c/cmd/traffic_crashlog/traffic_crashlog.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_crashlog/traffic_crashlog.cc b/cmd/traffic_crashlog/traffic_crashlog.cc
index 7c5599f..e35085f 100644
--- a/cmd/traffic_crashlog/traffic_crashlog.cc
+++ b/cmd/traffic_crashlog/traffic_crashlog.cc
@@ -88,6 +88,7 @@ main(int /* argc ATS_UNUSED */, const char **argv)
   char *logname;
   TSMgmtError mgmterr;
   crashlog_target target;
+  pid_t parent = getppid();
 
   diags = new Diags("" /* tags */, "" /* actions */, stderr);
 
@@ -101,6 +102,12 @@ main(int /* argc ATS_UNUSED */, const char **argv)
     kill(getpid(), SIGSTOP);
   }
 
+  // If our parent changed, then we were woken after traffic_server exited. There's no point trying to
+  // emit a crashlog because traffic_server is gone.
+  if (getppid() != parent) {
+    return 0;
+  }
+
   // XXX This is a hack. traffic_manager starts traffic_server with the euid of the admin user. We are still
   // privileged, but won't be able to open files in /proc or ptrace the target. This really should be fixed
   // in traffic_manager.