You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2013/04/15 22:46:13 UTC

[06/50] git commit: TS-1736: Fatal() terminates process without a backtrace

TS-1736: Fatal() terminates process without a backtrace

The root casue is that cleanup_func() was called before logging
backtrace in Diags::error(), however cleanup_func() would terminate
process by calling exit() directly.


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

Branch: refs/heads/3.3.x
Commit: dbe42413cbda864f31552d1f2544f8d489e1f2f5
Parents: 7f7c388
Author: Yunkai Zhang <yu...@gmail.com>
Authored: Tue Apr 2 11:56:30 2013 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Mon Apr 15 14:45:42 2013 -0600

----------------------------------------------------------------------
 CHANGES                    |    5 ++++-
 mgmt/LocalManager.cc       |    6 ++----
 mgmt/LocalManager.h        |    2 +-
 mgmt/Main.cc               |    3 ++-
 mgmt/api/CoreAPI.cc        |    2 +-
 mgmt/cluster/ClusterCom.cc |    4 ++--
 mgmt/utils/MgmtUtils.cc    |    2 +-
 7 files changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/dbe42413/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 9883ad7..04d63ad 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,9 +2,12 @@
   Changes with Apache Traffic Server 3.3.2
 
 
+  *) [TS-1736] Fatal() terminates process without a backtrace
+    Author: Yunkai Zhang <yu...@gmail.com>
+
   *) [TS-1791] remove m_mutex acquire&release to avoid deadlock in
    ~LogBufferList(). Author: Gang Li <qu...@taobao.com>.
-   
+
   *) [TS-1713] SRV support refine. Now the srv option is able to enable, with
    no crash. Be care, the hostdb.storage_size or ostdb.size need check.
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/dbe42413/mgmt/LocalManager.cc
----------------------------------------------------------------------
diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc
index 20a711d..aaddf18 100644
--- a/mgmt/LocalManager.cc
+++ b/mgmt/LocalManager.cc
@@ -62,7 +62,7 @@ LocalManager::mgmtCleanup()
 
 
 void
-LocalManager::mgmtShutdown(int status, bool mainThread)
+LocalManager::mgmtShutdown(bool mainThread)
 {
   if (mainThread) {
     mgmt_log("[LocalManager::mgmtShutdown] Executing shutdown request.\n");
@@ -70,7 +70,7 @@ LocalManager::mgmtShutdown(int status, bool mainThread)
     // WCCP TBD: Send a shutdown message to routers.
 
     if (processRunning()) {
-      waitpid(watched_process_pid, &status, 0);
+      waitpid(watched_process_pid, NULL, 0);
 #if defined(linux)
       /* Avert race condition, wait for the thread to complete,
          before getting one more restart process */
@@ -78,9 +78,7 @@ LocalManager::mgmtShutdown(int status, bool mainThread)
       mgmt_sleep_msec(1);
 #endif
     }
-
     mgmtCleanup();
-    _exit(status);
   } else {
     mgmt_shutdown_outstanding = true;
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/dbe42413/mgmt/LocalManager.h
----------------------------------------------------------------------
diff --git a/mgmt/LocalManager.h b/mgmt/LocalManager.h
index 92e7d65..8df0640 100644
--- a/mgmt/LocalManager.h
+++ b/mgmt/LocalManager.h
@@ -87,7 +87,7 @@ public:
   void closeProxyPorts();
 
   void mgmtCleanup();
-  void mgmtShutdown(int status, bool mainThread = false);
+  void mgmtShutdown(bool mainThread = false);
   void processShutdown(bool mainThread = false);
   void processRestart();
   void processBounce();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/dbe42413/mgmt/Main.cc
----------------------------------------------------------------------
diff --git a/mgmt/Main.cc b/mgmt/Main.cc
index 2463689..3760366 100644
--- a/mgmt/Main.cc
+++ b/mgmt/Main.cc
@@ -798,7 +798,8 @@ main(int argc, char **argv)
     }
 
     if (lmgmt->mgmt_shutdown_outstanding == true) {
-      lmgmt->mgmtShutdown(0, true);
+      lmgmt->mgmtShutdown(true);
+      _exit(0);
     }
 
     if (lmgmt->run_proxy && !lmgmt->processRunning()) { /* Make sure we still have a proxy up */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/dbe42413/mgmt/api/CoreAPI.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/CoreAPI.cc b/mgmt/api/CoreAPI.cc
index 43c5f30..c5a1a21 100644
--- a/mgmt/api/CoreAPI.cc
+++ b/mgmt/api/CoreAPI.cc
@@ -256,7 +256,7 @@ Restart(bool cluster)
     // this will kill TM completely;traffic_cop will restart TM/TS
     lmgmt->ccom->sendClusterMessage(CLUSTER_MSG_SHUTDOWN_MANAGER);
   } else {                      // just bounce local proxy
-    lmgmt->mgmtShutdown(0);
+    lmgmt->mgmtShutdown();
   }
 
   return TS_ERR_OKAY;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/dbe42413/mgmt/cluster/ClusterCom.cc
----------------------------------------------------------------------
diff --git a/mgmt/cluster/ClusterCom.cc b/mgmt/cluster/ClusterCom.cc
index 4a40c24..6f15a91 100644
--- a/mgmt/cluster/ClusterCom.cc
+++ b/mgmt/cluster/ClusterCom.cc
@@ -273,7 +273,7 @@ drainIncomingChannel(void *arg)
             delete buff;
         } else if (strstr(message, "cmd: shutdown_manager")) {
           mgmt_log("[ClusterCom::drainIncomingChannel] Received manager shutdown request\n");
-          lmgmt->mgmtShutdown(0);
+          lmgmt->mgmtShutdown();
         } else if (strstr(message, "cmd: shutdown_process")) {
           mgmt_log("[ClusterCom::drainIncomingChannel] Received process shutdown request\n");
           lmgmt->processShutdown();
@@ -1789,7 +1789,7 @@ ClusterCom::sendClusterMessage(int msg_type, const char *args)
 
   switch (msg_type) {
   case CLUSTER_MSG_SHUTDOWN_MANAGER:
-    lmgmt->mgmtShutdown(0);
+    lmgmt->mgmtShutdown();
     break;
   case CLUSTER_MSG_SHUTDOWN_PROCESS:
     lmgmt->processShutdown();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/dbe42413/mgmt/utils/MgmtUtils.cc
----------------------------------------------------------------------
diff --git a/mgmt/utils/MgmtUtils.cc b/mgmt/utils/MgmtUtils.cc
index 6a5c40e..29d4401 100644
--- a/mgmt/utils/MgmtUtils.cc
+++ b/mgmt/utils/MgmtUtils.cc
@@ -473,7 +473,7 @@ mgmt_cleanup()
 {
 #if defined(LOCAL_MANAGER)
   if (lmgmt != NULL) {
-    lmgmt->mgmtShutdown(1, true);
+    lmgmt->mgmtShutdown(true);
   }
 #endif
 }