trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpe...@apache.org
Subject trafficserver git commit: mgmt: remove unused proxy.config.lm.sem_id
Date Sun, 08 Nov 2015 20:48:05 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 204f41efa -> 0f05774d3


mgmt: remove unused proxy.config.lm.sem_id

proxy.config.lm.sem_id actually does nothing. It is exchaned in
management messages and traffic_cop tries to remove stale semaphores
based on its value. Nothing ever creates, increments or decrements
a semaphore with this ID.


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

Branch: refs/heads/master
Commit: 0f05774d35e434c8251c49df5f77cbc12f95bf19
Parents: 204f41e
Author: James Peach <jpeach@apache.org>
Authored: Sun Nov 8 12:04:43 2015 -0800
Committer: James Peach <jpeach@apache.org>
Committed: Sun Nov 8 12:45:47 2015 -0800

----------------------------------------------------------------------
 cmd/traffic_cop/traffic_cop.cc              | 36 ++++--------------------
 doc/admin-guide/files/records.config.en.rst |  4 ---
 lib/perl/lib/Apache/TS/AdminClient.pm       |  1 -
 mgmt/LocalManager.cc                        | 21 ++------------
 mgmt/LocalManager.h                         |  2 --
 mgmt/MgmtDefs.h                             | 30 +++-----------------
 mgmt/ProcessManager.cc                      | 22 +--------------
 mgmt/ProcessManager.h                       |  1 -
 mgmt/RecordsConfig.cc                       |  2 --
 9 files changed, 12 insertions(+), 107 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0f05774d/cmd/traffic_cop/traffic_cop.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_cop/traffic_cop.cc b/cmd/traffic_cop/traffic_cop.cc
index 178c3f6..133a979 100644
--- a/cmd/traffic_cop/traffic_cop.cc
+++ b/cmd/traffic_cop/traffic_cop.cc
@@ -136,7 +136,6 @@ static const int kill_timeout = 1 * 60; //  1 min
 
 static int child_pid = 0;
 static int child_status = 0;
-static int sem_id = 11452;
 
 AppVersionInfo appVersionInfo;
 
@@ -660,7 +659,6 @@ config_reload_records()
   config_read_int("proxy.config.process_manager.mgmt_port", &http_backdoor_port, true);
   config_read_int("proxy.config.admin.synthetic_port", &synthetic_port, true);
   config_read_int("proxy.config.cluster.rsport", &rs_port, true);
-  config_read_int("proxy.config.lm.sem_id", &sem_id, true);
   config_read_int("proxy.config.cop.init_sleep_time", &init_sleep_time, true);
 
 #if defined(linux)
@@ -731,34 +729,10 @@ spawn_manager()
   char *options[OPTIONS_MAX];
   char *last;
   char *tok;
-  int err;
-  int key;
 
   ats_scoped_str bindir(config_read_bin_dir());
 
   cop_log_trace("Entering spawn_manager()\n");
-  // Clean up shared memory segments.
-  if (sem_id > 0) {
-    key = sem_id;
-  } else {
-    key = 11452;
-  }
-  for (;; key++) {
-    err = semget(key, 1, 0666);
-    if (err < 0) {
-      break;
-    }
-#if defined(solaris) || defined(kfreebsd) || defined(unknown)
-    err = semctl(err, 1, IPC_RMID);
-#else
-    union semun dummy_semun;
-    memset(&dummy_semun, 0, sizeof(dummy_semun));
-    err = semctl(err, 1, IPC_RMID, dummy_semun);
-#endif
-    if (err < 0) {
-      break;
-    }
-  }
 
   Layout::relative_to(prog, sizeof(prog), bindir, manager_binary);
   if (access(prog, R_OK | X_OK) == -1) {
@@ -801,14 +775,14 @@ spawn_manager()
     }
   }
 
-  err = fork();
-  if (err == 0) {
+  pid_t child = fork();
+  if (child == 0) {
     EnableDeathSignal(SIGTERM);
 
-    err = execv(prog, options);
-    cop_log_trace("Somehow execv(%s, options, NULL) failed (%d)!\n", prog, err);
+    execv(prog, options);
+    cop_log_trace("Somehow execv(%s, options, NULL) failed: %s (%d)!\n", prog, strerror(errno),
errno);
     exit(1);
-  } else if (err == -1) {
+  } else if (child == -1) {
     cop_log(COP_FATAL, "unable to fork [%d '%s']\n", errno, strerror(errno));
     exit(1);
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0f05774d/doc/admin-guide/files/records.config.en.rst
----------------------------------------------------------------------
diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst
index 8513ecb..f59658a 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -459,10 +459,6 @@ this be local"
 Local Manager
 =============
 
-.. ts:cv:: CONFIG proxy.config.lm.sem_id INT 11452
-
-   The semaphore ID for the local manager.
-
 .. ts:cv:: CONFIG proxy.config.admin.synthetic_port INT 8083
 
    The synthetic healthcheck port.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0f05774d/lib/perl/lib/Apache/TS/AdminClient.pm
----------------------------------------------------------------------
diff --git a/lib/perl/lib/Apache/TS/AdminClient.pm b/lib/perl/lib/Apache/TS/AdminClient.pm
index e378303..28d128d 100644
--- a/lib/perl/lib/Apache/TS/AdminClient.pm
+++ b/lib/perl/lib/Apache/TS/AdminClient.pm
@@ -571,7 +571,6 @@ The Apache Traffic Server Administration Manual will explain what these
strings
  proxy.config.io.max_buffer_size
  proxy.config.lm.pserver_timeout_msecs
  proxy.config.lm.pserver_timeout_secs
- proxy.config.lm.sem_id
  proxy.config.local_state_dir
  proxy.config.log.ascii_buffer_size
  proxy.config.log.auto_delete_rolled_files

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0f05774d/mgmt/LocalManager.cc
----------------------------------------------------------------------
diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc
index 13ca742..1775f22 100644
--- a/mgmt/LocalManager.cc
+++ b/mgmt/LocalManager.cc
@@ -169,7 +169,7 @@ LocalManager::clusterOk()
 bool
 LocalManager::processRunning()
 {
-  if (watched_process_fd != -1 && watched_process_pid != -1) {
+  if (watched_process_fd != ts::NO_FD && watched_process_pid != -1) {
     return true;
   } else {
     return false;
@@ -193,11 +193,6 @@ LocalManager::LocalManager(bool proxy_on) : BaseManager(), run_proxy(proxy_on),
   mgmt_shutdown_outstanding = MGMT_PENDING_NONE;
   proxy_running = 0;
   RecSetRecordInt("proxy.node.proxy_running", 0, REC_SOURCE_DEFAULT);
-  mgmt_sync_key = REC_readInteger("proxy.config.lm.sem_id", &found);
-  if (!found || mgmt_sync_key <= 0) {
-    mgmt_log("Bad or missing proxy.config.lm.sem_id value; using default id %d\n", MGMT_SEMID_DEFAULT);
-    mgmt_sync_key = MGMT_SEMID_DEFAULT;
-  }
 
   virt_map = NULL;
 
@@ -403,7 +398,7 @@ LocalManager::pollMgmtProcessServer()
     timeout.tv_usec = process_server_timeout_msecs * 1000;
     FD_ZERO(&fdlist);
     FD_SET(process_server_sockfd, &fdlist);
-    if (watched_process_fd != -1)
+    if (watched_process_fd != ts::NO_FD)
       FD_SET(watched_process_fd, &fdlist);
 
 #if TS_HAS_WCCP
@@ -432,8 +427,6 @@ LocalManager::pollMgmtProcessServer()
         struct sockaddr_in clientAddr;
         socklen_t clientLen = sizeof(clientAddr);
         int new_sockfd = mgmt_accept(process_server_sockfd, (struct sockaddr *)&clientAddr,
&clientLen);
-        MgmtMessageHdr *mh;
-        int data_len;
 
         mgmt_log(stderr, "[LocalManager::pollMgmtProcessServer] New process connecting fd
'%d'\n", new_sockfd);
 
@@ -441,16 +434,6 @@ LocalManager::pollMgmtProcessServer()
           mgmt_elog(stderr, errno, "[LocalManager::pollMgmtProcessServer] ==> ");
         } else if (!processRunning()) {
           watched_process_fd = new_sockfd;
-          data_len = sizeof(mgmt_sync_key);
-          mh = (MgmtMessageHdr *)alloca(sizeof(MgmtMessageHdr) + data_len);
-          mh->msg_id = MGMT_EVENT_SYNC_KEY;
-          mh->data_len = data_len;
-          memcpy((char *)mh + sizeof(MgmtMessageHdr), &mgmt_sync_key, data_len);
-          if (mgmt_write_pipe(new_sockfd, (char *)mh, sizeof(MgmtMessageHdr) + data_len)
<= 0) {
-            mgmt_elog(errno, "[LocalManager::pollMgmtProcessServer] Error writing sync key
message!\n");
-            close_socket(new_sockfd);
-            watched_process_fd = watched_process_pid = -1;
-          }
         } else {
           close_socket(new_sockfd);
         }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0f05774d/mgmt/LocalManager.h
----------------------------------------------------------------------
diff --git a/mgmt/LocalManager.h b/mgmt/LocalManager.h
index 45ea4cc..a660461 100644
--- a/mgmt/LocalManager.h
+++ b/mgmt/LocalManager.h
@@ -126,8 +126,6 @@ public:
   volatile int watched_process_fd;
   volatile pid_t proxy_launch_pid;
 
-  int mgmt_sync_key;
-
   Alarms *alarm_keeper;
   VMap *virt_map;
   FileManager *configFiles;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0f05774d/mgmt/MgmtDefs.h
----------------------------------------------------------------------
diff --git a/mgmt/MgmtDefs.h b/mgmt/MgmtDefs.h
index c4cd86a..8dde7b9 100644
--- a/mgmt/MgmtDefs.h
+++ b/mgmt/MgmtDefs.h
@@ -31,14 +31,14 @@
  *
  */
 
-#ifndef _MGMT_DEF_H
-#define _MGMT_DEF_H
+#ifndef _MGMT_DEFS_H
+#define _MGMT_DEFS_H
 
 /*
  * Type definitions.
  */
 #include "ts/ink_defs.h"
-#include "ts/ink_hrtime.h"
+//#include "ts/ink_hrtime.h"
 
 typedef int64_t MgmtIntCounter;
 typedef int64_t MgmtInt;
@@ -61,28 +61,6 @@ typedef enum {
  */
 typedef void *(*MgmtCallback)(void *opaque_cb_data, char *data_raw, int data_len);
 
-#define MGMT_SEMID_DEFAULT 11452
-#define MGMT_DB_FILENAME "mgmt_db"
 #define LM_CONNECTION_SERVER "processerver.sock"
 
-/* Structs used in Average Statistics calculations */
-struct StatTwoIntSamples {
-  const char *lm_record_name;
-  ink_hrtime previous_time;
-  ink_hrtime current_time;
-  MgmtInt previous_value;
-  MgmtInt current_value;
-
-  MgmtInt
-  diff_value()
-  {
-    return (current_value - previous_value);
-  }
-  ink_hrtime
-  diff_time()
-  {
-    return (current_time - previous_time);
-  }
-};
-
-#endif /* _MGMT_DEF_H */
+#endif /* _MGMT_DEFS_H */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0f05774d/mgmt/ProcessManager.cc
----------------------------------------------------------------------
diff --git a/mgmt/ProcessManager.cc b/mgmt/ProcessManager.cc
index b37a9bc..cb8cba2 100644
--- a/mgmt/ProcessManager.cc
+++ b/mgmt/ProcessManager.cc
@@ -66,7 +66,7 @@ startProcessManager(void *arg)
   return ret;
 } /* End startProcessManager */
 
-ProcessManager::ProcessManager(bool rlm) : BaseManager(), require_lm(rlm), mgmt_sync_key(0),
local_manager_sockfd(0), cbtable(NULL)
+ProcessManager::ProcessManager(bool rlm) : BaseManager(), require_lm(rlm), local_manager_sockfd(0),
cbtable(NULL)
 {
   mgmt_signal_queue = create_queue();
 
@@ -166,10 +166,8 @@ ProcessManager::initLMConnection()
   ats_scoped_str rundir(RecConfigReadRuntimeDir());
   ats_scoped_str sockpath(Layout::relative_to(rundir, LM_CONNECTION_SERVER));
 
-  MgmtMessageHdr mh_hdr;
   MgmtMessageHdr *mh_full;
   int data_len;
-  char *sync_key_raw = NULL;
 
   int servlen;
   struct sockaddr_un serv_addr;
@@ -206,24 +204,6 @@ ProcessManager::initLMConnection()
     mgmt_fatal(stderr, errno, "[ProcessManager::initLMConnection] Error writing message!\n");
   }
 
-  /* Read SYNC_KEY from manager */
-  if (mgmt_read_pipe(local_manager_sockfd, (char *)&mh_hdr, sizeof(MgmtMessageHdr)) <=
0) {
-    mgmt_fatal(stderr, errno, "[ProcessManager::initLMConnection] Error reading sem message!\n");
-  } else {
-    // coverity[uninit_use]
-    mh_full = (MgmtMessageHdr *)alloca(sizeof(MgmtMessageHdr) + mh_hdr.data_len);
-    memcpy(mh_full, &mh_hdr, sizeof(MgmtMessageHdr));
-    sync_key_raw = (char *)mh_full + sizeof(MgmtMessageHdr);
-    if (mgmt_read_pipe(local_manager_sockfd, sync_key_raw, mh_hdr.data_len) < 0) {
-      mgmt_fatal(stderr, errno, "[ProcessManager::initLMConnection] Error reading sem message!\n");
-    }
-  }
-
-
-  if (sync_key_raw)
-    memcpy(&mgmt_sync_key, sync_key_raw, sizeof(mgmt_sync_key));
-  Debug("pmgmt", "[ProcessManager::initLMConnection] Received key: %d\n", mgmt_sync_key);
-
 } /* End ProcessManager::initLMConnection */
 
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0f05774d/mgmt/ProcessManager.h
----------------------------------------------------------------------
diff --git a/mgmt/ProcessManager.h b/mgmt/ProcessManager.h
index ea2388c..ad3e9ab 100644
--- a/mgmt/ProcessManager.h
+++ b/mgmt/ProcessManager.h
@@ -91,7 +91,6 @@ public:
 
   bool require_lm;
   time_t timeout;
-  int mgmt_sync_key;
 
   LLQ *mgmt_signal_queue;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0f05774d/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 1a37264..dc60715 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -241,8 +241,6 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.lm.pserver_timeout_msecs", RECD_INT, "0", RECU_NULL, RR_NULL,
RECC_NULL, NULL, RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.lm.sem_id", RECD_INT, "11452", RECU_NULL, RR_REQUIRED, RECC_NULL,
NULL, RECA_NULL}
-  ,                             // needed by cop
   {RECT_CONFIG, "proxy.config.cluster.delta_thresh", RECD_INT, "30", RECU_NULL, RR_NULL,
RECC_NULL, NULL, RECA_NULL}
   ,
   {RECT_CONFIG, "proxy.config.cluster.peer_timeout", RECD_INT, "30", RECU_NULL, RR_NULL,
RECC_NULL, NULL, RECA_NULL}


Mime
View raw message