You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2014/08/26 02:53:23 UTC

git commit: Log the uid and pid when receiving a SIGTERM.

Repository: mesos
Updated Branches:
  refs/heads/master d45c79676 -> d5bbc3549


Log the uid and pid when receiving a SIGTERM.

Review: https://reviews.apache.org/r/24700


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

Branch: refs/heads/master
Commit: d5bbc3549cb601b45b48c584b192620ebce2b671
Parents: d45c796
Author: Alexandra Sava <al...@gmail.com>
Authored: Mon Aug 25 17:51:10 2014 -0700
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Mon Aug 25 17:53:16 2014 -0700

----------------------------------------------------------------------
 .../3rdparty/stout/include/stout/glog.hpp         | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d5bbc354/3rdparty/libprocess/3rdparty/stout/include/stout/glog.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/glog.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/glog.hpp
index 5f763e5..cec7f4d 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/glog.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/glog.hpp
@@ -35,10 +35,17 @@
 // it should work in 'most' cases in signal handlers.
 namespace internal {
 
-inline void handler(int signal)
+inline void handler(int signal, siginfo_t *siginfo, void *context)
 {
   if (signal == SIGTERM) {
-    RAW_LOG(WARNING, "Received signal SIGTERM; exiting.");
+    if (siginfo->si_code == SI_USER ||
+        siginfo->si_code == SI_QUEUE ||
+        siginfo->si_code <= 0) {
+      RAW_LOG(WARNING, "Received signal SIGTERM from process %d of user %d; "
+                       "exiting", siginfo->si_pid, siginfo->si_uid);
+    } else {
+      RAW_LOG(WARNING, "Received signal SIGTERM; exiting");
+    }
 
     // Setup the default handler for SIGTERM so that we don't print
     // a stack trace.
@@ -70,11 +77,14 @@ inline void installFailureSignalHandler()
 
   // Set up our custom signal handlers.
   struct sigaction action;
-  action.sa_handler = internal::handler;
+  action.sa_sigaction = internal::handler;
 
   // Do not block additional signals while in the handler.
   sigemptyset(&action.sa_mask);
-  action.sa_flags = 0;
+
+  // The SA_SIGINFO flag tells sigaction() to use
+  // the sa_sigaction field, not sa_handler.
+  action.sa_flags = SA_SIGINFO;
 
   // Set up the SIGPIPE signal handler to escalate to SIGABRT
   // in order to have the glog handler catch it and print all