You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zy...@apache.org on 2012/04/04 18:30:39 UTC

git commit: TS-1178 cop will kill manager & server, even cop it self

Updated Branches:
  refs/heads/master 2075d4369 -> 040e5172a


TS-1178 cop will kill manager & server, even cop it self

the strcmp erro issue is created by jMCg in
d88f875694f629a296ed60d8f42f82a1657cfa8a, we also fix the safe_kill do
not try to kill ourself.


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

Branch: refs/heads/master
Commit: 040e5172ae24fc0f3318b7b9700459abeb188841
Parents: 2075d43
Author: Zhao Yongming <mi...@gmail.com>
Authored: Wed Apr 4 19:55:09 2012 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Thu Apr 5 00:29:06 2012 +0800

----------------------------------------------------------------------
 CHANGES            |    2 ++
 cop/TrafficCop.cc  |    8 ++++----
 lib/ts/lockfile.cc |    7 +++----
 3 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/040e5172/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 68f4e78..1822bb4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,7 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 3.1.4
+  *) [TS-1178] cop will kill manager & server, even cop it self, in cluster.
+
   *) [TS-1156] Fix timestamp log fields, and stop supporting network byte
    order in various log buffers. See TS-1182 for future enhancements.
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/040e5172/cop/TrafficCop.cc
----------------------------------------------------------------------
diff --git a/cop/TrafficCop.cc b/cop/TrafficCop.cc
index af908d0..477c19d 100644
--- a/cop/TrafficCop.cc
+++ b/cop/TrafficCop.cc
@@ -121,7 +121,6 @@ static ink_hrtime manager_flap_retry_start_time = 0;    // first time we attempt
 
 static const int kill_timeout = 1 * 60; //  1 min
 
-
 static int child_pid = 0;
 static int child_status = 0;
 static int sem_id = 11452;
@@ -197,7 +196,7 @@ static void
 sig_child(int signum)
 {
   NOWARN_UNUSED(signum);
-  int pid = 0;
+  pid_t pid = 0;
   int status = 0;
 
 #ifdef TRACE_LOG_COP
@@ -1091,7 +1090,7 @@ read_manager_string(const char *variable, char *value, size_t val_len)
     return -1;
   }
 
-  ink_strlcpy(value, p, val_len);
+  ink_strlcpy(value, p, e - p + 1);
 
   return 0;
 }
@@ -1682,7 +1681,8 @@ check(void *arg)
         cop_log(COP_WARNING, "child terminated due to signal %d: %s\n", sig, strsignal(sig));
       }
 
-      child_pid = child_status = 0;
+      child_pid = 0;
+      child_status = 0;
     }
 
     // Re-read the config file information

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/040e5172/lib/ts/lockfile.cc
----------------------------------------------------------------------
diff --git a/lib/ts/lockfile.cc b/lib/ts/lockfile.cc
index 9cfaed5..5cde39a 100644
--- a/lib/ts/lockfile.cc
+++ b/lib/ts/lockfile.cc
@@ -279,7 +279,7 @@ void
 Lockfile::KillGroup(int sig, int initial_sig, const char *pname)
 {
   int err;
-  int pid;
+  pid_t pid;
   pid_t holding_pid;
 
   err = Open(&holding_pid);
@@ -292,11 +292,10 @@ Lockfile::KillGroup(int sig, int initial_sig, const char *pname)
       pid = getpgid(holding_pid);
     } while ((pid < 0) && (errno == EINTR));
 
-    if (pid < 0) {
+    if ((pid < 0) || (pid == getpid()))
       pid = holding_pid;
-    } else {
+    else
       pid = -pid;
-    }
 
     if (pid != 0) {
       // We kill the holding_pid instead of the process_group