You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ge...@apache.org on 2010/02/11 22:51:32 UTC

svn commit: r909161 - in /incubator/trafficserver/traffic/branches/dev: ./ proxy/ proxy/http2/ proxy/logging/ proxy/mgmt2/ proxy/mgmt2/web2/

Author: georgep
Date: Thu Feb 11 21:51:32 2010
New Revision: 909161

URL: http://svn.apache.org/viewvc?rev=909161&view=rev
Log:
Merge TS-161,TS-159,TS-116,TS-151,TS-163 changes from trunk into dev branch.

Added:
    incubator/trafficserver/traffic/branches/dev/STATUS
      - copied unchanged from r909127, incubator/trafficserver/traffic/trunk/STATUS
Modified:
    incubator/trafficserver/traffic/branches/dev/   (props changed)
    incubator/trafficserver/traffic/branches/dev/proxy/Main.cc
    incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpConfig.cc
    incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpConfig.h
    incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpSM.cc
    incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpSessionManager.cc
    incubator/trafficserver/traffic/branches/dev/proxy/logging/LogBuffer.cc
    incubator/trafficserver/traffic/branches/dev/proxy/logging/LogBuffer.h
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/RecordsConfig.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Rollback.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebCompatibility.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttpLog.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttpRender.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebIntrMain.cc
    incubator/trafficserver/traffic/branches/dev/proxy/signals.cc

Propchange: incubator/trafficserver/traffic/branches/dev/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Feb 11 21:51:32 2010
@@ -1 +1 @@
-/incubator/trafficserver/traffic/trunk:891822-908349
+/incubator/trafficserver/traffic/trunk:891822-909127

Modified: incubator/trafficserver/traffic/branches/dev/proxy/Main.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/Main.cc?rev=909161&r1=909160&r2=909161&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/Main.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/Main.cc Thu Feb 11 21:51:32 2010
@@ -1726,7 +1726,6 @@
   //   yet we do not know where
   openlog("traffic_server", LOG_PID | LOG_NDELAY | LOG_NOWAIT, LOG_DAEMON);
 
-  init_system();
 
 
   // Setup Diags temporary to allow librecords to be initialized.
@@ -1751,6 +1750,7 @@
   // Set the core limit for the process
   init_core_size();
 
+  init_system();
   // Init memalign heaps
   init_ink_memalign_heap();
 

Modified: incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpConfig.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpConfig.cc?rev=909161&r1=909160&r2=909161&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpConfig.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpConfig.cc Thu Feb 11 21:51:32 2010
@@ -1017,6 +1017,8 @@
 
   HttpEstablishStaticConfigLongLong(c.origin_max_connections, "proxy.config.http.origin_max_connections");
 
+  HttpEstablishStaticConfigLongLong(c.origin_min_keep_alive_connections, "proxy.config.http.origin_min_keep_alive_connections");
+
   HttpEstablishStaticConfigLongLong(c.parent_proxy_routing_enable, "proxy.config.http.parent_proxy_routing_enable");
 
   // Wank me.
@@ -1371,6 +1373,14 @@
 
   params->origin_max_connections = m_master.origin_max_connections;
 
+  params->origin_min_keep_alive_connections = m_master.origin_min_keep_alive_connections;
+
+  if( params->origin_max_connections &&
+      params->origin_max_connections < params->origin_min_keep_alive_connections ) {
+    Warning("origin_max_connections < origin_min_keep_alive_connections, setting min=max , please correct your records.config");
+    params->origin_min_keep_alive_connections = params->origin_max_connections;
+  }
+
   params->parent_proxy_routing_enable = INT_TO_BOOL(m_master.parent_proxy_routing_enable);
 
   // Traffic Net

Modified: incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpConfig.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpConfig.h?rev=909161&r1=909160&r2=909161&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpConfig.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpConfig.h Thu Feb 11 21:51:32 2010
@@ -411,6 +411,7 @@
 
   MgmtInt server_max_connections;
   MgmtInt origin_max_connections;
+  MgmtInt origin_min_keep_alive_connections;
 
   MgmtInt parent_proxy_routing_enable;
   MgmtInt disable_ssl_parenting;
@@ -857,6 +858,7 @@
 outgoing_ip_to_bind_saddr(0),
 server_max_connections(0),
 origin_max_connections(0),
+origin_min_keep_alive_connections(0),
 parent_proxy_routing_enable(false),
 disable_ssl_parenting(0),
 enable_url_expandomatic(0),

Modified: incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpSM.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpSM.cc?rev=909161&r1=909160&r2=909161&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpSM.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpSM.cc Thu Feb 11 21:51:32 2010
@@ -1818,11 +1818,13 @@
   switch (event) {
   case NET_EVENT_OPEN:
     session = THREAD_ALLOC_INIT(httpServerSessionAllocator, mutex->thread_holding);
-    // If origin_max_connections is set then we are limiting the number
+    // If origin_max_connections or origin_min_keep_alive_connections is 
+    // set then we are metering the max and or min number
     // of connections per host.  Set enable_origin_connection_limiting
     // to true in the server session so it will increment and decrement
     // the connection count.
-    if (t_state.http_config_param->origin_max_connections > 0) {
+    if (t_state.http_config_param->origin_max_connections > 0 || 
+        t_state.http_config_param->origin_min_keep_alive_connections > 0) {
       Debug("http_ss", "[%lld] max number of connections: %u",
             sm_id, t_state.http_config_param->origin_max_connections);
       session->enable_origin_connection_limiting = true;

Modified: incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpSessionManager.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpSessionManager.cc?rev=909161&r1=909160&r2=909161&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpSessionManager.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpSessionManager.cc Thu Feb 11 21:51:32 2010
@@ -80,6 +80,32 @@
   s = l2_hash[l2_index].head;
   while (s != NULL) {
     if (s->get_netvc() == net_vc) {
+
+      // if there was a timeout of some kind on a keep alive connection, and 
+      // keeping the connection alive will not keep us above the # of max connections
+      // to the origin and we are below the min number of keep alive connections to this 
+      // origin, then reset the timeouts on our end and do not close the connection
+      if( (event == VC_EVENT_INACTIVITY_TIMEOUT || event == VC_EVENT_ACTIVE_TIMEOUT) &&
+           s->state == HSS_KA_SHARED &&
+           s->enable_origin_connection_limiting ) {
+
+        HttpConfigParams *http_config_params = HttpConfig::acquire();
+        bool connection_count_below_min = s->connection_count->getCount(s->server_ip) <= http_config_params->origin_min_keep_alive_connections;
+        HttpConfig::release(http_config_params);
+
+        if( connection_count_below_min ) {
+          Debug("http_ss", "[%b64d] [session_bucket] session received io notice [%s], "
+                "reseting timeout to maintain minimum number of connections", s->con_id,
+                HttpDebugNames::get_event_name(event));
+          s->get_netvc()->set_inactivity_timeout(HRTIME_SECONDS(
+            HttpConfig::m_master.keep_alive_no_activity_timeout_out));
+          s->get_netvc()->set_active_timeout(HRTIME_SECONDS(
+            HttpConfig::m_master.keep_alive_no_activity_timeout_out));
+          return 0;
+        }
+      }
+
+
       // We've found our server session. Remove it from
       //   our lists and close it down
       Debug("http_ss", "[%lld] [session_bucket] session received "
@@ -284,6 +310,7 @@
     // Transfer control of the write side as well
     to_release->do_io_write(bucket, 0, NULL);
 
+    // we probably don't need the active timeout set, but will leave it for now
     to_release->get_netvc()->
       set_inactivity_timeout(HRTIME_SECONDS(HttpConfig::m_master.keep_alive_no_activity_timeout_out));
     to_release->get_netvc()->

Modified: incubator/trafficserver/traffic/branches/dev/proxy/logging/LogBuffer.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/logging/LogBuffer.cc?rev=909161&r1=909160&r2=909161&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/logging/LogBuffer.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/logging/LogBuffer.cc Thu Feb 11 21:51:32 2010
@@ -62,23 +62,21 @@
 };
 
 enum
-{ FIELDLIST_CACHE_SIZE = 256 };
+{
+  FIELDLIST_CACHE_SIZE = 256
+};
+
 FieldListCacheElement fieldlist_cache[FIELDLIST_CACHE_SIZE];
 int fieldlist_cache_entries = 0;
-vink32
-  LogBuffer::M_ID = 0;
+vink32 LogBuffer::M_ID = 0;
 
 //iObjectActivator  iObjectActivatorInstance;     /* just to do ::Init() before main() */
 
-iObject *
-  iObject::free_heap = 0;       /* list of free blocks */
-ink_mutex
-  iObject::iObjectMutex;        /* mutex for access iObject class global variables */
+iObject *iObject::free_heap = 0;       /* list of free blocks */
+ink_mutex iObject::iObjectMutex;        /* mutex for access iObject class global variables */
 
-iLogBufferBuffer *
-  iLogBufferBuffer::free_heap = 0;      /* list of free blocks */
-ink_mutex
-  iLogBufferBuffer::iLogBufferBufferMutex;      /* mutex for access iLogBufferBuffer class global variables */
+iLogBufferBuffer *iLogBufferBuffer::free_heap = 0;      /* list of free blocks */
+ink_mutex iLogBufferBuffer::iLogBufferBufferMutex;      /* mutex for access iLogBufferBuffer class global variables */
 
 
 /* --------------------- iStaticBuf_LogBuffer::Init ------------------------ */
@@ -156,15 +154,14 @@
 
 /* ---------------------------- iObject::new ------------------------------- */
 void *
-  iObject::operator
-new(size_t _size)
+iObject::operator new(size_t _size)
 {
-  iObject **objj, **objj_best = 0;
-  iObject *ob = 0, *ob_best = 0;
+  iObject **objj, **objj_best = NULL;
+  iObject *ob = NULL, *ob_best = NULL;
   size_t real_size = _size;
 
   ink_mutex_acquire(&iObjectMutex);
-  for (objj = &free_heap; (ob = *objj) != 0; objj = &(ob->next_object)) {
+  for (objj = &free_heap; (ob = *objj) != NULL; objj = &(ob->next_object)) {
     if (ob->class_size == _size) {
       *objj = ob->next_object;
       break;
@@ -193,8 +190,7 @@
 
 /* --------------------------- iObject::delete ----------------------------- */
 void
-  iObject::operator
-delete(void *p)
+iObject::operator delete(void *p)
 {
   iObject *ob = (iObject *) p;
 
@@ -270,13 +266,13 @@
   -------------------------------------------------------------------------*/
 
 LogBuffer::LogBuffer(LogObject * owner, size_t size, int buf_align_mask, int write_align_mask):
-sign(CLASS_SIGN_LOGBUFFER),
-next_flush(NULL),
-next_list(NULL),
-m_new_buffer(NULL),
-m_size(size),
-m_buf_align_mask(buf_align_mask),
-m_write_align_mask(write_align_mask), m_max_entries(Log::config->max_entries_per_buffer), m_owner(owner)
+  sign(CLASS_SIGN_LOGBUFFER),
+  next_flush(NULL),
+  next_list(NULL),
+  m_new_buffer(NULL),
+  m_size(size),
+  m_buf_align_mask(buf_align_mask),
+  m_write_align_mask(write_align_mask), m_max_entries(Log::config->max_entries_per_buffer), m_owner(owner)
 {
   size_t hdr_size;
 
@@ -307,15 +303,15 @@
 }
 
 LogBuffer::LogBuffer(LogObject * owner, LogBufferHeader * header):
-sign(CLASS_SIGN_LOGBUFFER),
-next_flush(NULL),
-next_list(NULL),
-m_bb(NULL),
-m_unaligned_buffer(NULL),
-m_buffer((char *) header),
-m_size(0),
-m_buf_align_mask(LB_DEFAULT_ALIGN_MASK),
-m_write_align_mask(MIN_ALIGN - 1), m_max_entries(0), m_expiration_time(0), m_owner(owner), m_header(header)
+  sign(CLASS_SIGN_LOGBUFFER),
+  next_flush(NULL),
+  next_list(NULL),
+  m_bb(NULL),
+  m_unaligned_buffer(NULL),
+  m_buffer((char *) header),
+  m_size(0),
+  m_buf_align_mask(LB_DEFAULT_ALIGN_MASK),
+  m_write_align_mask(MIN_ALIGN - 1), m_max_entries(0), m_expiration_time(0), m_owner(owner), m_header(header)
 {
   // This constructor does not allocate a buffer because it gets it as 
   // an argument. We set m_unaligned_buffer to NULL, which means that 

Modified: incubator/trafficserver/traffic/branches/dev/proxy/logging/LogBuffer.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/logging/LogBuffer.h?rev=909161&r1=909160&r2=909161&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/logging/LogBuffer.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/logging/LogBuffer.h Thu Feb 11 21:51:32 2010
@@ -108,10 +108,12 @@
   LB_State():ival(0)
   {
   };
+
   LB_State(volatile LB_State & vs)
   {
     ival = vs.ival;
   };
+
   LB_State & operator =(volatile LB_State & vs)
   {
     ival = vs.ival;
@@ -143,22 +145,23 @@
 
 
 protected:
-    iObject(const iObject &);   /* declared; not implemented - block copying and assignment */
-    iObject & operator=(const iObject &);       /* ditto */
+  iObject(const iObject &);   /* declared; not implemented - block copying and assignment */
+  iObject & operator=(const iObject &);       /* ditto */
 
 public:
   static void Init(void);
   void *operator  new(size_t size);
   void operator  delete(void *p);
 
-    iObject():class_size(0), next_object(NULL)
-  {                             /* nop */
-  }
-  virtual ~ iObject()
-  {                             /* nop */
-  }
+ iObject() 
+ {                             /* nop */
+ }
+
+ virtual ~iObject()
+ {                             /* nop */
+ }
 
-  friend class iObjectActivator;
+ friend class iObjectActivator;
 };
 
 /* ------------------------------ iLogBufferBuffer ------------------------- */
@@ -172,13 +175,14 @@
   size_t real_buf_size;
 
 
-    iLogBufferBuffer()
+  iLogBufferBuffer()
   {
     next = 0;
     buf = 0;
     real_buf_size = (size = 0);
   }
-   ~iLogBufferBuffer()
+
+  ~iLogBufferBuffer()
   {
     if (buf)
       xfree(buf);
@@ -209,7 +213,8 @@
     iObject::Init();
     iLogBufferBuffer::Init();
   }
-   ~iObjectActivator()
+
+  ~iObjectActivator()
   {                             /* nop */
   }
 };

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/RecordsConfig.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/RecordsConfig.cc?rev=909161&r1=909160&r2=909161&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/RecordsConfig.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/RecordsConfig.cc Thu Feb 11 21:51:32 2010
@@ -90,6 +90,8 @@
   //# Negative core limit means max out limit
   {CONFIG, "proxy.config.core_limit", "", INK_INT, "0", RU_NULL, RR_NULL, RC_NULL, NULL, RA_NULL}
   ,
+  {CONFIG, "proxy.config.stack_dump_enabled", "", INK_INT, "1", RU_NULL, RR_NULL, RC_NULL, NULL, RA_NULL}
+  ,
   {CONFIG, "proxy.config.cop.core_signal", "", INK_INT, "0", RU_NULL, RR_REQUIRED, RC_NULL, NULL, RA_NULL}
   ,                             // needed by traffic_cop
   {CONFIG, "proxy.config.cop.linux_min_swapfree_kb", "", INK_INT, "10240", RU_NULL, RR_REQUIRED, RC_NULL, NULL, RA_NULL}
@@ -922,6 +924,8 @@
   ,
   {CONFIG, "proxy.config.http.origin_max_connections", "", INK_INT, "0", RU_REREAD, RR_NULL, RC_INT, "^[0-9]+$", RA_NULL}
   ,
+  {CONFIG, "proxy.config.http.origin_min_keep_alive_connections", "", INK_INT, "0", RU_REREAD, RR_NULL, RC_INT, "^[0-9]+$", RA_NULL}
+  ,
 
   //       ##########################
   //       # HTTP referer filtering #

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Rollback.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Rollback.cc?rev=909161&r1=909160&r2=909161&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Rollback.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Rollback.cc Thu Feb 11 21:51:32 2010
@@ -345,7 +345,7 @@
       mgmt_log(stderr, "[Rollback] Unable to acquire root privileges.\n");
     }
   }
-  fd = mgmt_open_mode(filePath, oflags, 0600);
+  fd = mgmt_open_mode(filePath, oflags, 0644);
   if (root_access_needed) {
     if (removeRootPriv() != true) {
       mgmt_log(stderr, "[Rollback] Unable to restore non-root privileges.\n");

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebCompatibility.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebCompatibility.cc?rev=909161&r1=909160&r2=909161&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebCompatibility.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebCompatibility.cc Thu Feb 11 21:51:32 2010
@@ -82,7 +82,7 @@
 
   WebHandle h_file;
 
-  if ((h_file = mgmt_open_mode(file, O_WRONLY | O_APPEND | O_CREAT, 0600)) < 0) {
+  if ((h_file = mgmt_open_mode(file, O_WRONLY | O_APPEND | O_CREAT, 0644)) < 0) {
     return WEB_HANDLE_INVALID;
   }
   fcntl(h_file, F_SETFD, 1);

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttpLog.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttpLog.cc?rev=909161&r1=909160&r2=909161&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttpLog.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttpLog.cc Thu Feb 11 21:51:32 2010
@@ -31,7 +31,7 @@
 #include "ink_config.h"
 #include "ink_platform.h"
 #include "TextBuffer.h"
-
+#include "Main.h"
 #include "WebCompatibility.h"
 #include "WebHttpLog.h"
 
@@ -48,9 +48,32 @@
 void
 WebHttpLogInit()
 {
+  struct stat s;
+  int err;
+  char *log_dir;
+  char log_file[PATH_NAME_MAX+1];
+
+  if ((err = stat(system_log_dir, &s)) < 0) {
+    ink_assert(RecGetRecordString_Xmalloc("proxy.config.log2.logfile_dir", &log_dir) 
+	       == REC_ERR_OKAY);
+    if ((err = stat(log_dir, &s)) < 0) {
+      // Try 'system_root_dir/var/log/trafficserver' directory
+      ink_snprintf(system_log_dir, sizeof(system_log_dir), "%s%s%s%s%s%s%s",
+               system_root_dir, DIR_SEP,"var",DIR_SEP,"log",DIR_SEP,"trafficserver");
+      if ((err = stat(system_log_dir, &s)) < 0) {
+        mgmt_elog("unable to stat() log dir'%s': %d %d, %s\n", 
+                system_log_dir, err, errno, strerror(errno));
+        mgmt_elog("please set 'proxy.config.log2.logfile_dir'\n");
+        //_exit(1);
+      }
+    } else {
+      ink_strncpy(system_log_dir,log_dir,sizeof(system_log_dir)); 
+    }
+  } 
 
+  ink_snprintf(log_file, sizeof(log_file), "%s%s%s", system_log_dir, DIR_SEP, "lm.log");
   if (WebHttpLogHandle == WEB_HANDLE_INVALID) {
-    WebHttpLogHandle = WebFileOpenW("lm.log");
+    WebHttpLogHandle = WebFileOpenW(log_file);
   }
 
 }

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttpRender.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttpRender.cc?rev=909161&r1=909160&r2=909161&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttpRender.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttpRender.cc Thu Feb 11 21:51:32 2010
@@ -1655,18 +1655,36 @@
   struct dirent *dent;
   DIR *dirp;
   DIR *dirp2;
+  struct stat s;
+  int err;
 
   // open all files in the log directory except traffic.out
-  ink_assert(RecGetRecordString_Xmalloc("proxy.config.log2.logfile_dir", &logdir)
-             == REC_ERR_OKAY);
   ink_assert(RecGetRecordString_Xmalloc("proxy.config.output.logfile", &logfile)
              == REC_ERR_OKAY);
 
-  if ((dirp = opendir(logdir))) {
+  if ((err = stat(system_log_dir, &s)) < 0) {
+    ink_assert(RecGetRecordString_Xmalloc("proxy.config.log2.logfile_dir", &logdir) 
+	       == REC_ERR_OKAY);
+    if ((err = stat(logdir, &s)) < 0) {
+      // Try 'system_root_dir/var/log/trafficserver' directory
+      ink_snprintf(system_log_dir, sizeof(system_log_dir), "%s%s%s%s%s%s%s",
+               system_root_dir, DIR_SEP,"var",DIR_SEP,"log",DIR_SEP,"trafficserver");
+      if ((err = stat(system_log_dir, &s)) < 0) {
+        mgmt_elog("unable to stat() log dir'%s': %d %d, %s\n", 
+                system_log_dir, err, errno, strerror(errno));
+        mgmt_elog("please set 'proxy.config.log2.logfile_dir'\n");
+        //_exit(1);
+      }
+    } else {
+      ink_strncpy(system_log_dir,logdir,sizeof(system_log_dir)); 
+    }
+  } 
+
+  if ((dirp = opendir(system_log_dir))) {
     while ((dent = readdir(dirp)) != NULL) {
       // exclude traffic.out*
       if (strncmp(logfile, dent->d_name, strlen(logfile)) != 0) {
-        ink_snprintf(tmp, MAX_TMP_BUF_LEN, "%s/%s", logdir, dent->d_name);
+        ink_snprintf(tmp, MAX_TMP_BUF_LEN, "%s%s%s", system_log_dir, DIR_SEP, dent->d_name);
         if ((dirp2 = opendir(tmp))) {
           // exclude directory
           closedir(dirp2);
@@ -1717,17 +1735,36 @@
     "manager.log",
     "lm.log"
   };
+  struct stat s;
+  int err;
+
 
-  ink_assert(RecGetRecordString_Xmalloc("proxy.config.log2.logfile_dir", &logdir)
-             == REC_ERR_OKAY);
   ink_assert(RecGetRecordString_Xmalloc("proxy.config.output.logfile", &logfile)
              == REC_ERR_OKAY);
 
+  if ((err = stat(system_log_dir, &s)) < 0) {
+    ink_assert(RecGetRecordString_Xmalloc("proxy.config.log2.logfile_dir", &logdir) 
+	       == REC_ERR_OKAY);
+    if ((err = stat(logdir, &s)) < 0) {
+      // Try 'system_root_dir/var/log/trafficserver' directory
+      ink_snprintf(system_log_dir, sizeof(system_log_dir), "%s%s%s%s%s%s%s",
+               system_root_dir, DIR_SEP,"var",DIR_SEP,"log",DIR_SEP,"trafficserver");
+      if ((err = stat(system_log_dir, &s)) < 0) {
+        mgmt_elog("unable to stat() log dir'%s': %d %d, %s\n", 
+                system_log_dir, err, errno, strerror(errno));
+        mgmt_elog("please set 'proxy.config.log2.logfile_dir'\n");
+        //_exit(1);
+      }
+    } else {
+      ink_strncpy(system_log_dir,logdir,sizeof(system_log_dir)); 
+    }
+  } 
+
   // traffic.out*
-  if ((dirp = opendir(logdir))) {
+  if ((dirp = opendir(system_log_dir))) {
     while ((dent = readdir(dirp)) != NULL) {
       if (strncmp(logfile, dent->d_name, strlen(logfile)) == 0) {
-        ink_snprintf(tmp, MAX_TMP_BUF_LEN, "%s/%s", logdir, dent->d_name);
+        ink_snprintf(tmp, MAX_TMP_BUF_LEN, "%s%s%s", system_log_dir, DIR_SEP, dent->d_name);
         if (readable(tmp, &fsize)) {
           selected = selected_log(whc, tmp);
           bytesFromInt(fsize, tmp3);

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebIntrMain.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebIntrMain.cc?rev=909161&r1=909160&r2=909161&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebIntrMain.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebIntrMain.cc Thu Feb 11 21:51:32 2010
@@ -244,11 +244,35 @@
 static int
 setUpLogging()
 {
+  struct stat s;
+  int err;
+  char *log_dir;
+  char log_file[PATH_NAME_MAX+1];
+
+  if ((err = stat(system_log_dir, &s)) < 0) {
+    ink_assert(RecGetRecordString_Xmalloc("proxy.config.log2.logfile_dir", &log_dir) 
+	       == REC_ERR_OKAY);
+    if ((err = stat(log_dir, &s)) < 0) {
+      // Try 'system_root_dir/var/log/trafficserver' directory
+      ink_snprintf(system_log_dir, sizeof(system_log_dir), "%s%s%s%s%s%s%s",
+               system_root_dir, DIR_SEP,"var",DIR_SEP,"log",DIR_SEP,"trafficserver");
+      if ((err = stat(system_log_dir, &s)) < 0) {
+        mgmt_elog("unable to stat() log dir'%s': %d %d, %s\n", 
+                system_log_dir, err, errno, strerror(errno));
+        mgmt_elog("please set 'proxy.config.log2.logfile_dir'\n");
+        //_exit(1);
+      }
+    } else {
+      ink_strncpy(system_log_dir,log_dir,sizeof(system_log_dir)); 
+    }
+  } 
+
+  ink_snprintf(log_file, sizeof(log_file), "%s%s%s", system_log_dir, DIR_SEP, "lm.log");
 
-  int diskFD = open("lm.log", O_WRONLY | O_APPEND | O_CREAT, 0600);
+  int diskFD = open(log_file, O_WRONLY | O_APPEND | O_CREAT, 0644);
 
   if (diskFD < 0) {
-    mgmt_log(stderr, "[setUpLogging] Unable to open log file.  No logging will occur: %s\n", strerror(errno));
+    mgmt_log(stderr, "[setUpLogging] Unable to open log file (%s).  No logging will occur: %s\n", log_file,strerror(errno));
   }
 
   fcntl(diskFD, F_SETFD, 1);

Modified: incubator/trafficserver/traffic/branches/dev/proxy/signals.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/signals.cc?rev=909161&r1=909160&r2=909161&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/signals.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/signals.cc Thu Feb 11 21:51:32 2010
@@ -237,7 +237,6 @@
 signal_handler(int sig, siginfo_t * t, void *c)
 #endif
 {
-
   if (sig == SIGUSR1) {
     sigusr1_received = 1;
     return;
@@ -461,6 +460,14 @@
 void
 init_signals()
 {
+  RecInt stackDump;
+  bool found = (RecGetRecordInt("proxy.config.stack_dump_enabled", &stackDump) == REC_ERR_OKAY);
+
+  if(found == false) {
+    Warning("Unable to determine stack_dump_enabled , assuming enabled");
+    stackDump = 1;
+  }
+
   sigset_t sigsToBlock;
   sigemptyset(&sigsToBlock);
   ink_thread_sigsetmask(SIG_SETMASK, &sigsToBlock, NULL);
@@ -470,8 +477,10 @@
   set_signal(SIGTERM, (SigActionFunc_t) signal_handler);
   set_signal(SIGHUP, (SigActionFunc_t) interrupt_handler);
   set_signal(SIGILL, (SigActionFunc_t) signal_handler);
-  set_signal(SIGBUS, (SigActionFunc_t) signal_handler);
-  set_signal(SIGSEGV, (SigActionFunc_t) signal_handler);
+  if(stackDump == 1) {
+    set_signal(SIGBUS, (SigActionFunc_t) signal_handler);
+    set_signal(SIGSEGV, (SigActionFunc_t) signal_handler);
+  }
 
 //
 //    Presviously the following lines were #if 0