trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject [1/2] trafficserver git commit: TS-3618: Crashes in traffic_cop on shutdown / restart
Date Tue, 19 May 2015 02:47:16 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 37569c139 -> 3ea9ccc30


TS-3618: Crashes in traffic_cop on shutdown / restart


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

Branch: refs/heads/master
Commit: 591984cf0a288d0ac51c5d49fed7faf1f07d2a9f
Parents: 37569c1
Author: Brian Geffon <briang@apache.org>
Authored: Mon May 18 19:46:38 2015 -0700
Committer: Brian Geffon <briang@apache.org>
Committed: Mon May 18 19:46:38 2015 -0700

----------------------------------------------------------------------
 cmd/traffic_cop/traffic_cop.cc | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/591984cf/cmd/traffic_cop/traffic_cop.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_cop/traffic_cop.cc b/cmd/traffic_cop/traffic_cop.cc
index 1a9ebad..a535cdf 100644
--- a/cmd/traffic_cop/traffic_cop.cc
+++ b/cmd/traffic_cop/traffic_cop.cc
@@ -81,6 +81,7 @@ static int coresig = 0;
 static int debug_flag = false;
 static int stdout_flag = false;
 static int stop_flag = false;
+static volatile int sig_term_received = 0;
 
 static char *admin_user;
 static uid_t admin_uid;
@@ -271,7 +272,7 @@ sig_term(int signum)
     child_status = status;
   }
   cop_log_trace("Leaving sig_term(%d), exiting traffic_cop\n", signum);
-  exit(0);
+  sig_term_received = 1;
 }
 
 static void
@@ -828,7 +829,15 @@ poll_read_or_write(int fd, int timeout, int inorout)
   info.revents = 0;
 
   do {
+    if (sig_term_received) {
+          exit(0);
+    }
+
     err = poll(&info, 1, timeout);
+
+    if (sig_term_received) {
+      exit(0);
+    }
   } while ((err < 0) && (transient_error(errno, TRANSIENT_ERROR_WAIT_MS)));
 
   if ((err > 0) && (info.revents & inorout)) {


Mime
View raw message