Updated Branches:
  refs/heads/master b3fd17694 -> b1f0300f7

TS-1960 Decouple stacksize config from core


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

Branch: refs/heads/master
Commit: 92c9140ee5d594ca5223bcf4549c7745ebada5da
Parents: b3fd176
Author: Leif Hedstrom <[email protected]>
Authored: Tue Jun 18 17:29:43 2013 -0600
Committer: Leif Hedstrom <[email protected]>
Committed: Mon Jun 24 14:18:58 2013 -0600

----------------------------------------------------------------------
 iocore/aio/AIO.cc                        |  5 +++-
 iocore/aio/test_AIO.cc                   |  4 +--
 iocore/cluster/ClusterProcessor.cc       |  4 ++-
 iocore/dns/DNS.cc                        |  5 ++--
 iocore/dns/I_DNSProcessor.h              |  2 +-
 iocore/eventsystem/I_EventProcessor.h    |  6 ++--
 iocore/eventsystem/I_Processor.h         |  8 +++--
 iocore/eventsystem/I_Tasks.h             |  2 +-
 iocore/eventsystem/I_Thread.h            |  2 +-
 iocore/eventsystem/Tasks.cc              |  7 +++--
 iocore/eventsystem/Thread.cc             |  5 +---
 iocore/eventsystem/UnixEventProcessor.cc | 12 ++++----
 iocore/eventsystem/test_Buffer.cc        |  2 +-
 iocore/eventsystem/test_Event.cc         |  2 +-
 iocore/net/I_NetProcessor.h              |  2 +-
 iocore/net/I_UDPNet.h                    |  2 +-
 iocore/net/P_SSLNetProcessor.h           |  2 +-
 iocore/net/P_UDPNet.h                    |  2 +-
 iocore/net/P_UnixNetProcessor.h          |  2 +-
 iocore/net/SSLNetProcessor.cc            |  6 ++--
 iocore/net/UnixNetAccept.cc              |  5 +++-
 iocore/net/UnixNetProcessor.cc           | 43 +++++++++++----------------
 iocore/net/UnixUDPNet.cc                 |  4 +--
 lib/records/I_RecProcess.h               |  2 +-
 lib/records/RecProcess.cc                |  8 ++---
 proxy/Main.cc                            | 19 +++++++-----
 proxy/UglyLogStubs.cc                    |  6 ++--
 proxy/http/remap/RemapProcessor.cc       |  4 +--
 proxy/http/remap/RemapProcessor.h        |  2 +-
 proxy/logging/Log.cc                     |  5 +++-
 proxy/sac.cc                             |  7 +++--
 31 files changed, 98 insertions(+), 89 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/aio/AIO.cc
----------------------------------------------------------------------
diff --git a/iocore/aio/AIO.cc b/iocore/aio/AIO.cc
index 1cd1500..56cc51a 100644
--- a/iocore/aio/AIO.cc
+++ b/iocore/aio/AIO.cc
@@ -248,13 +248,16 @@ aio_init_fildes(int fildes, int fromAPI = 0)
 
   /* create the main thread */
   AIOThreadInfo *thr_info;
+  size_t stacksize;
+
+  REC_ReadConfigInteger(stacksize, "proxy.config.thread.default.stacksize");
   for (i = 0; i < thread_num; i++) {
     if (i == (thread_num - 1))
       thr_info = new AIOThreadInfo(request, 1);
     else
       thr_info = new AIOThreadInfo(request, 0);
     snprintf(thr_name, MAX_THREAD_NAME_LENGTH, "[ET_AIO %d]", i);
-    ink_assert(eventProcessor.spawn_thread(thr_info, thr_name));
+    ink_assert(eventProcessor.spawn_thread(thr_info, thr_name, stacksize));
   }
 
   /* the num_filedes should be incremented after initializing everything.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/aio/test_AIO.cc
----------------------------------------------------------------------
diff --git a/iocore/aio/test_AIO.cc b/iocore/aio/test_AIO.cc
index 817d8a2..633fce5 100644
--- a/iocore/aio/test_AIO.cc
+++ b/iocore/aio/test_AIO.cc
@@ -477,8 +477,8 @@ main(int /* argc ATS_UNUSED */, char *argv[])
   init_diags("", NULL);
   RecProcessInit(RECM_STAND_ALONE);
   ink_event_system_init(EVENT_SYSTEM_MODULE_VERSION);
-  eventProcessor.start(ink_number_of_processors());
-  RecProcessStart();
+  eventProcessor.start(ink_number_of_processors(), 1048576); // Hardcoded 
stack size to 1MB
+  RecProcessStart(1048576); // Hadcoded stack size to 1MB
   ink_aio_init(AIO_MODULE_VERSION);
   srand48(time(NULL));
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/cluster/ClusterProcessor.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterProcessor.cc 
b/iocore/cluster/ClusterProcessor.cc
index 30e7505..7f2a173 100644
--- a/iocore/cluster/ClusterProcessor.cc
+++ b/iocore/cluster/ClusterProcessor.cc
@@ -730,8 +730,10 @@ ClusterProcessor::start()
   this_cluster_machine()->cluster_port = cluster_port;
 #endif
   if (cache_clustering_enabled && (cacheProcessor.IsCacheEnabled() == 
CACHE_INITIALIZED)) {
+    size_t stacksize;
 
-    ET_CLUSTER = eventProcessor.spawn_event_threads(num_of_cluster_threads, 
"ET_CLUSTER");
+    REC_ReadConfigInteger(stacksize, "proxy.config.thread.default.stacksize");
+    ET_CLUSTER = eventProcessor.spawn_event_threads(num_of_cluster_threads, 
"ET_CLUSTER", stacksize);
     for (int i = 0; i < eventProcessor.n_threads_for_type[ET_CLUSTER]; i++) {
       initialize_thread_for_net(eventProcessor.eventthread[ET_CLUSTER][i], i);
     }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/dns/DNS.cc
----------------------------------------------------------------------
diff --git a/iocore/dns/DNS.cc b/iocore/dns/DNS.cc
index ceee91d..5313896 100644
--- a/iocore/dns/DNS.cc
+++ b/iocore/dns/DNS.cc
@@ -164,7 +164,7 @@ make_ipv6_ptr(in6_addr const* addr, char *buffer)
 //  See documentation is header files and Memos
 //
 int
-DNSProcessor::start(int) {
+DNSProcessor::start(int, size_t stacksize) {
   //
   // Read configuration
   //
@@ -183,7 +183,8 @@ DNSProcessor::start(int) {
   REC_EstablishStaticConfigInt32(dns_thread, 
"proxy.config.dns.dedicated_thread");
 
   if (dns_thread > 0) {
-    ET_DNS = eventProcessor.spawn_event_threads(1, "ET_DNS"); // TODO: Hmmm, 
should we just get a single thread some other way?
+    // TODO: Hmmm, should we just get a single thread some other way?
+    ET_DNS = eventProcessor.spawn_event_threads(1, "ET_DNS", stacksize);
     initialize_thread_for_net(eventProcessor.eventthread[ET_DNS][0], 0);
   } else {
     // Initialize the first event thread for DNS.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/dns/I_DNSProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/dns/I_DNSProcessor.h b/iocore/dns/I_DNSProcessor.h
index 28c13a5..ede3da3 100644
--- a/iocore/dns/I_DNSProcessor.h
+++ b/iocore/dns/I_DNSProcessor.h
@@ -118,7 +118,7 @@ struct DNSProcessor: public Processor
   //
   /* currently dns system uses event threads
    * dont pass any value to the call */
-  int start(int no_of_extra_dns_threads = 0);
+  int start(int no_of_extra_dns_threads, size_t stacksize);
 
   // Open/close a link to a 'named' (done in start())
   //

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/eventsystem/I_EventProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_EventProcessor.h 
b/iocore/eventsystem/I_EventProcessor.h
index 357213a..ee784d3 100644
--- a/iocore/eventsystem/I_EventProcessor.h
+++ b/iocore/eventsystem/I_EventProcessor.h
@@ -112,7 +112,7 @@ public:
     @return event object representing the start of the thread.
 
   */
-  Event *spawn_thread(Continuation * cont, const char *thr_name, ink_sem * sem 
= NULL);
+  Event *spawn_thread(Continuation * cont, const char *thr_name, size_t 
stacksize, ink_sem * sem = NULL);
 
   /**
     Spawns a group of threads for an event type. Spawns the number of
@@ -123,7 +123,7 @@ public:
     @return EventType or thread id for the new group of threads.
 
   */
-  EventType spawn_event_threads(int n_threads, const char* et_name);
+  EventType spawn_event_threads(int n_threads, const char* et_name, size_t 
stacksize);
 
 
   /**
@@ -246,7 +246,7 @@ public:
     @return 0 if successful, and a negative value otherwise.
 
   */
-  int start(int n_net_threads);
+  int start(int n_net_threads, size_t stacksize);
 
   /**
     Stop the EventProcessor. Attempts to stop the EventProcessor and

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/eventsystem/I_Processor.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_Processor.h b/iocore/eventsystem/I_Processor.h
index 240f50f..e80255e 100644
--- a/iocore/eventsystem/I_Processor.h
+++ b/iocore/eventsystem/I_Processor.h
@@ -93,13 +93,15 @@ public:
     processor, initializes their states and sets them running. On
     failure it returns a negative value.
 
-    @param number_of_threads Positive value indicating the number
-      of threads to spawn for the processor.
+    @param number_of_threads Positive value indicating the number of
+        threads to spawn for the processor.
+    @param stacksize The thread stack size to use for this processor.
 
   */
-  virtual int start(int number_of_threads)
+  virtual int start(int number_of_threads, size_t stacksize)
   {
     (void) number_of_threads;
+    (void) stacksize;
     return 0;
   }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/eventsystem/I_Tasks.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_Tasks.h b/iocore/eventsystem/I_Tasks.h
index 5e8c8ea..e4b0dc2 100644
--- a/iocore/eventsystem/I_Tasks.h
+++ b/iocore/eventsystem/I_Tasks.h
@@ -32,7 +32,7 @@ extern EventType ET_TASK;
 class TasksProcessor: public Processor
 {
  public: 
-  int start(int task_threads = 0);
+  int start(int task_threads, size_t stacksize);
 };
 
 extern TasksProcessor tasksProcessor;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/eventsystem/I_Thread.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_Thread.h b/iocore/eventsystem/I_Thread.h
index 9f21937..ce6b2d8 100644
--- a/iocore/eventsystem/I_Thread.h
+++ b/iocore/eventsystem/I_Thread.h
@@ -129,7 +129,7 @@ private:
   Thread & operator =(const Thread &);
 
 public:
-  ink_thread start(const char* name, ThreadFunction f = NULL, void *a = NULL, 
size_t stacksize = 0);
+  ink_thread start(const char* name, size_t stacksize, ThreadFunction f = 
NULL, void *a = NULL);
 
   virtual void execute()
   {  }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/eventsystem/Tasks.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/Tasks.cc b/iocore/eventsystem/Tasks.cc
index 7d1c55f..dd27fcc 100644
--- a/iocore/eventsystem/Tasks.cc
+++ b/iocore/eventsystem/Tasks.cc
@@ -28,9 +28,10 @@ EventType ET_TASK = ET_CALL;
 TasksProcessor tasksProcessor;
 
 int
-TasksProcessor::start(int task_threads)
+TasksProcessor::start(int task_threads, size_t stacksize)
 {
-  if (task_threads > 0)
-    ET_TASK = eventProcessor.spawn_event_threads(task_threads, "ET_TASK");
+  if (task_threads > 0) {
+    ET_TASK = eventProcessor.spawn_event_threads(task_threads, "ET_TASK", 
stacksize);
+  }
   return 0;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/eventsystem/Thread.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/Thread.cc b/iocore/eventsystem/Thread.cc
index afb3985..1a9c581 100644
--- a/iocore/eventsystem/Thread.cc
+++ b/iocore/eventsystem/Thread.cc
@@ -91,13 +91,10 @@ spawn_thread_internal(void *a)
 }
 
 ink_thread
-Thread::start(const char* name, ThreadFunction f, void *a, size_t stacksize)
+Thread::start(const char* name, size_t stacksize, ThreadFunction f, void *a)
 {
   thread_data_internal *p = (thread_data_internal 
*)ats_malloc(sizeof(thread_data_internal));
 
-  if (0 == stacksize)
-    REC_ReadConfigInteger(stacksize, "proxy.config.thread.default.stacksize");
-
   p->f = f;
   p->a = a;
   p->me = this;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/eventsystem/UnixEventProcessor.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/UnixEventProcessor.cc 
b/iocore/eventsystem/UnixEventProcessor.cc
index ac03170..5f4d646 100644
--- a/iocore/eventsystem/UnixEventProcessor.cc
+++ b/iocore/eventsystem/UnixEventProcessor.cc
@@ -91,7 +91,7 @@ bind_cpu(ink_cpuset_t *cpuset, ink_thread tid)
 #endif
 
 EventType
-EventProcessor::spawn_event_threads(int n_threads, const char* et_name)
+EventProcessor::spawn_event_threads(int n_threads, const char* et_name, size_t 
stacksize)
 {
   char thr_name[MAX_THREAD_NAME_LENGTH];
   EventType new_thread_group_id;
@@ -113,7 +113,7 @@ EventProcessor::spawn_event_threads(int n_threads, const 
char* et_name)
   n_threads_for_type[new_thread_group_id] = n_threads;
   for (i = 0; i < n_threads; i++) {
     snprintf(thr_name, MAX_THREAD_NAME_LENGTH, "[%s %d]", et_name, i);
-    eventthread[new_thread_group_id][i]->start(thr_name);
+    eventthread[new_thread_group_id][i]->start(thr_name, stacksize);
   }
 
   n_thread_groups++;
@@ -129,7 +129,7 @@ EventProcessor::spawn_event_threads(int n_threads, const 
char* et_name)
 class EventProcessor eventProcessor;
 
 int
-EventProcessor::start(int n_event_threads)
+EventProcessor::start(int n_event_threads, size_t stacksize)
 {
   char thr_name[MAX_THREAD_NAME_LENGTH];
   int i;
@@ -177,7 +177,7 @@ EventProcessor::start(int n_event_threads)
 
   for (i = first_thread; i < n_ethreads; i++) {
     snprintf(thr_name, MAX_THREAD_NAME_LENGTH, "[ET_NET %d]", i);
-    ink_thread tid = all_ethreads[i]->start(thr_name);
+    ink_thread tid = all_ethreads[i]->start(thr_name, stacksize);
     (void)tid;
 
 #if TS_USE_HWLOC
@@ -219,7 +219,7 @@ EventProcessor::shutdown()
 }
 
 Event *
-EventProcessor::spawn_thread(Continuation *cont, const char* thr_name, ink_sem 
*sem)
+EventProcessor::spawn_thread(Continuation *cont, const char* thr_name, size_t 
stacksize, ink_sem *sem)
 {
   ink_release_assert(n_dthreads < MAX_EVENT_THREADS);
   Event *e = eventAllocator.alloc();
@@ -229,7 +229,7 @@ EventProcessor::spawn_thread(Continuation *cont, const 
char* thr_name, ink_sem *
   e->ethread = dthreads[n_dthreads];
   e->mutex = e->continuation->mutex = dthreads[n_dthreads]->mutex;
   n_dthreads++;
-  e->ethread->start(thr_name);
+  e->ethread->start(thr_name, stacksize);
 
   return e;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/eventsystem/test_Buffer.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/test_Buffer.cc 
b/iocore/eventsystem/test_Buffer.cc
index 04eacbc..ba74ab4 100644
--- a/iocore/eventsystem/test_Buffer.cc
+++ b/iocore/eventsystem/test_Buffer.cc
@@ -127,7 +127,7 @@ main(int /* argc ATS_UNUSED */, const char */* argv 
ATS_UNUSED */[])
   RecProcessInit(mode_type);
 
   ink_event_system_init(EVENT_SYSTEM_MODULE_VERSION);
-  eventProcessor.start(TEST_THREADS);
+  eventProcessor.start(TEST_THREADS, 1048576); // Hardcoded stacksize at 1MB
 
   for (unsigned i = 0; i < 100; ++i) {
     MIOBuffer *b1 = new_MIOBuffer(default_large_iobuffer_size);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/eventsystem/test_Event.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/test_Event.cc b/iocore/eventsystem/test_Event.cc
index e7bf5b8..5724320 100644
--- a/iocore/eventsystem/test_Event.cc
+++ b/iocore/eventsystem/test_Event.cc
@@ -160,7 +160,7 @@ main(int /* argc ATS_UNUSED */, const char */* argv 
ATS_UNUSED */[])
   RecProcessInit(mode_type);
 
   ink_event_system_init(EVENT_SYSTEM_MODULE_VERSION);
-  eventProcessor.start(TEST_THREADS);
+  eventProcessor.start(TEST_THREADS, 1048576); // Hardcoded stacksize at 1MB
 
   alarm_printer *alrm = new alarm_printer(new_ProxyMutex());
   process_killer *killer = new process_killer(new_ProxyMutex());

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/net/I_NetProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_NetProcessor.h b/iocore/net/I_NetProcessor.h
index fc26468..3deae4c 100644
--- a/iocore/net/I_NetProcessor.h
+++ b/iocore/net/I_NetProcessor.h
@@ -219,7 +219,7 @@ public:
       uses the Event Processor threads for its activity.
 
   */
-  virtual int start(int number_of_net_threads = 0 /* uses event threads */ ) = 
0;
+  virtual int start(int number_of_net_threads, size_t stacksize) = 0;
 
   /** Private constructor. */
   NetProcessor()

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/net/I_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_UDPNet.h b/iocore/net/I_UDPNet.h
index 159e93b..b2e2d9a 100644
--- a/iocore/net/I_UDPNet.h
+++ b/iocore/net/I_UDPNet.h
@@ -45,7 +45,7 @@
 class UDPNetProcessor:public Processor
 {
 public:
-  virtual int start(int n_upd_threads) = 0;
+  virtual int start(int n_upd_threads, size_t stacksize) = 0;
 
   //this function was interanal intially.. this is required for public and
   //interface probably should change.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/net/P_SSLNetProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_SSLNetProcessor.h b/iocore/net/P_SSLNetProcessor.h
index f15ccf8..bdc00c3 100644
--- a/iocore/net/P_SSLNetProcessor.h
+++ b/iocore/net/P_SSLNetProcessor.h
@@ -49,7 +49,7 @@ struct SSLNetProcessor : public UnixNetProcessor
 {
 public:
 
-  virtual int start(int no_of_ssl_threads);
+  virtual int start(int no_of_ssl_threads, size_t stacksize);
 
   void cleanup(void);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/net/P_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h
index e695383..608bc53 100644
--- a/iocore/net/P_UDPNet.h
+++ b/iocore/net/P_UDPNet.h
@@ -46,7 +46,7 @@ struct UDPNetHandler;
 
 struct UDPNetProcessorInternal : public UDPNetProcessor
 {
-  virtual int start(int n_udp_threads);
+  virtual int start(int n_udp_threads, size_t stacksize);
   void udp_read_from_net(UDPNetHandler * nh, UDPConnection * uc, 
PollDescriptor * pd, EThread * thread);
   int udp_callback(UDPNetHandler * nh, UDPConnection * uc, EThread * thread);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/net/P_UnixNetProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UnixNetProcessor.h b/iocore/net/P_UnixNetProcessor.h
index 3573681..5e08e0a 100644
--- a/iocore/net/P_UnixNetProcessor.h
+++ b/iocore/net/P_UnixNetProcessor.h
@@ -65,7 +65,7 @@ public:
   virtual void freeThread(UnixNetVConnection * vc, EThread * t);
   virtual NetAccept *createNetAccept();
 
-  virtual int start(int number_of_net_threads = 0 /* uses event threads */ );
+  virtual int start(int number_of_net_threads, size_t stacksize);
 
   char *throttle_error_message;
   Event *accept_thread_event;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/net/SSLNetProcessor.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNetProcessor.cc b/iocore/net/SSLNetProcessor.cc
index 695c427..25b4204 100644
--- a/iocore/net/SSLNetProcessor.cc
+++ b/iocore/net/SSLNetProcessor.cc
@@ -44,7 +44,7 @@ SSLNetProcessor::cleanup(void)
 }
 
 int
-SSLNetProcessor::start(int number_of_ssl_threads)
+SSLNetProcessor::start(int number_of_ssl_threads, size_t stacksize)
 {
   // This initialization order matters ...
   SSLInitializeLibrary();
@@ -69,8 +69,8 @@ SSLNetProcessor::start(int number_of_ssl_threads)
     return -1;
   }
 
-  SSLNetProcessor::ET_SSL = 
eventProcessor.spawn_event_threads(number_of_ssl_threads, "ET_SSL");
-  return UnixNetProcessor::start();
+  SSLNetProcessor::ET_SSL = 
eventProcessor.spawn_event_threads(number_of_ssl_threads, "ET_SSL", stacksize);
+  return UnixNetProcessor::start(0, stacksize);
 }
 
 NetAccept *

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/net/UnixNetAccept.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetAccept.cc b/iocore/net/UnixNetAccept.cc
index 0136157..5f65535 100644
--- a/iocore/net/UnixNetAccept.cc
+++ b/iocore/net/UnixNetAccept.cc
@@ -174,8 +174,11 @@ EventType NetAccept::getEtype()
 void
 NetAccept::init_accept_loop()
 {
+  size_t stacksize;
+
+  REC_ReadConfigInteger(stacksize, "proxy.config.thread.default.stacksize");
   SET_CONTINUATION_HANDLER(this, &NetAccept::acceptLoopEvent);
-  eventProcessor.spawn_thread(this, "[ACCEPT]");
+  eventProcessor.spawn_thread(this, "[ACCEPT]", stacksize);
 }
 
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/net/UnixNetProcessor.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetProcessor.cc b/iocore/net/UnixNetProcessor.cc
index 20bfd61..a106c9a 100644
--- a/iocore/net/UnixNetProcessor.cc
+++ b/iocore/net/UnixNetProcessor.cc
@@ -53,6 +53,7 @@ NetProcessor::AcceptOptions::reset()
 
 
 int net_connection_number = 1;
+
 unsigned int
 net_next_connection_number()
 {
@@ -65,21 +66,17 @@ net_next_connection_number()
 }
 
 Action *
-NetProcessor::accept(Continuation* cont,
-  AcceptOptions const& opt
-) {
-  Debug("iocore_net_processor",
-        "NetProcessor::accept - port %d,recv_bufsize %d, send_bufsize %d, 
sockopt 0x%0x",
-    opt.local_port, opt.recv_bufsize, opt.send_bufsize, opt.sockopt_flags);
+NetProcessor::accept(Continuation* cont, AcceptOptions const& opt)
+{
+  Debug("iocore_net_processor", "NetProcessor::accept - port %d,recv_bufsize 
%d, send_bufsize %d, sockopt 0x%0x",
+        opt.local_port, opt.recv_bufsize, opt.send_bufsize, opt.sockopt_flags);
 
   return ((UnixNetProcessor *) this)->accept_internal(cont, NO_FD, opt);
 }
 
 Action *
-NetProcessor::main_accept(Continuation *cont,
-  SOCKET fd,
-  AcceptOptions const& opt
-) {
+NetProcessor::main_accept(Continuation *cont, SOCKET fd, AcceptOptions const& 
opt)
+{
   UnixNetProcessor* this_unp = static_cast<UnixNetProcessor*>(this);
   Debug("iocore_net_processor", "NetProcessor::main_accept - port 
%d,recv_bufsize %d, send_bufsize %d, sockopt 0x%0x",
         opt.local_port, opt.recv_bufsize, opt.send_bufsize, opt.sockopt_flags);
@@ -87,11 +84,8 @@ NetProcessor::main_accept(Continuation *cont,
 }
 
 Action *
-UnixNetProcessor::accept_internal(
-  Continuation *cont,
-  int fd,
-  AcceptOptions const& opt
-) {
+UnixNetProcessor::accept_internal(Continuation *cont, int fd, AcceptOptions 
const& opt)
+{
   EventType et = opt.etype; // setEtype requires non-const ref.
   NetAccept *na = createNetAccept();
   EThread *thread = this_ethread();
@@ -103,19 +97,21 @@ UnixNetProcessor::accept_internal(
   upgradeEtype(et);
 
   // Fill in accept thread from configuration if necessary.
-  if (opt.accept_threads < 0)
+  if (opt.accept_threads < 0) {
     REC_ReadConfigInteger(accept_threads, "proxy.config.accept_threads");
+  }
 
   NET_INCREMENT_DYN_STAT(net_accepts_currently_open_stat);
 
   // We've handled the config stuff at start up, but there are a few cases
   // we must handle at this point.
-  if (opt.localhost_only)
+  if (opt.localhost_only) {
     accept_ip.setToLoopback(opt.ip_family);
-  else if (opt.local_ip.isValid())
+  } else if (opt.local_ip.isValid()) {
     accept_ip.assign(opt.local_ip);
-  else
+  } else {
     accept_ip.setToAnyAddr(opt.ip_family);
+  }
   ink_assert(0 < opt.local_port && opt.local_port < 65536);
   accept_ip.port() = htons(opt.local_port);
 
@@ -124,11 +120,7 @@ UnixNetProcessor::accept_internal(
   ats_ip_copy(&na->server.accept_addr, &accept_ip);
   na->server.f_inbound_transparent = opt.f_inbound_transparent;
   if (opt.f_inbound_transparent) {
-    Debug(
-      "http_tproxy",
-      "Marking accept server %p on port %d as inbound transparent",
-      na, opt.local_port
-    );
+    Debug( "http_tproxy", "Marking accept server %p on port %d as inbound 
transparent", na, opt.local_port);
   }
 
   int should_filter_int = 0;
@@ -405,8 +397,9 @@ NetProcessor::connect_s(Continuation * cont, sockaddr 
const* target,
 
 struct PollCont;
 
+// This is a little odd, in that the actual threads are created before calling 
the processor.
 int
-UnixNetProcessor::start(int)
+UnixNetProcessor::start(int, size_t)
 {
   EventType etype = ET_NET;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/iocore/net/UnixUDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index 8a696ff..c92f29b 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -86,12 +86,12 @@ initialize_thread_for_udp_net(EThread * thread)
 }
 
 int
-UDPNetProcessorInternal::start(int n_upd_threads)
+UDPNetProcessorInternal::start(int n_upd_threads, size_t stacksize)
 {
   if (n_upd_threads < 1)
     return -1;
 
-  ET_UDP = eventProcessor.spawn_event_threads(n_upd_threads, "ET_UDP");
+  ET_UDP = eventProcessor.spawn_event_threads(n_upd_threads, "ET_UDP", 
stacksize);
   if (ET_UDP < 0)               // Probably can't happen, maybe at some point 
EventType should be unsigned ?
     return -1;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/lib/records/I_RecProcess.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecProcess.h b/lib/records/I_RecProcess.h
index 3664e2e..9340efd 100644
--- a/lib/records/I_RecProcess.h
+++ b/lib/records/I_RecProcess.h
@@ -33,7 +33,7 @@
 //-------------------------------------------------------------------------
 int RecProcessInit(RecModeT mode_type, Diags * diags = NULL);
 int RecProcessInitMessage(RecModeT mode_type);
-int RecProcessStart();
+int RecProcessStart(size_t stacksize);
 
 //-------------------------------------------------------------------------
 // Setters for manipulating internal sleep intervals

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/lib/records/RecProcess.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecProcess.cc b/lib/records/RecProcess.cc
index e1c9813..53edf36 100644
--- a/lib/records/RecProcess.cc
+++ b/lib/records/RecProcess.cc
@@ -444,7 +444,7 @@ RecProcessInitMessage(RecModeT mode_type)
 // RecProcessStart
 //-------------------------------------------------------------------------
 int
-RecProcessStart()
+RecProcessStart(size_t stacksize)
 {
   if (g_started) {
     return REC_ERR_OKAY;
@@ -453,15 +453,15 @@ RecProcessStart()
   Debug("statsproc", "Starting sync processors:");
   raw_stat_sync_cont *rssc = NEW(new raw_stat_sync_cont(new_ProxyMutex()));
   Debug("statsproc", "\traw-stat syncer");
-  eventProcessor.spawn_thread(rssc, "[STAT_SYNC]");
+  eventProcessor.spawn_thread(rssc, "[STAT_SYNC]", stacksize);
 
   config_update_cont *cuc = NEW(new config_update_cont(new_ProxyMutex()));
   Debug("statsproc", "\tconfig syncer");
-  eventProcessor.spawn_thread(cuc, "[CONF_SYNC]");
+  eventProcessor.spawn_thread(cuc, "[CONF_SYNC]", stacksize);
 
   sync_cont *sc = NEW(new sync_cont(new_ProxyMutex()));
   Debug("statsproc", "\tremote syncer");
-  eventProcessor.spawn_thread(sc, "[REM_SYNC]");
+  eventProcessor.spawn_thread(sc, "[REM_SYNC]", stacksize);
 
   g_started = true;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 505262e..ac74a4d 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -1517,6 +1517,9 @@ main(int argc, char **argv)
 
   adjust_num_of_net_threads();
 
+  size_t stacksize;
+  REC_ReadConfigInteger(stacksize, "proxy.config.thread.default.stacksize");
+
   ink_event_system_init(makeModuleVersion(1, 0, PRIVATE_MODULE_HEADER));
   ink_net_init(makeModuleVersion(1, 0, PRIVATE_MODULE_HEADER));
   ink_aio_init(makeModuleVersion(1, 0, PRIVATE_MODULE_HEADER));
@@ -1524,7 +1527,7 @@ main(int argc, char **argv)
   ink_hostdb_init(makeModuleVersion(HOSTDB_MODULE_MAJOR_VERSION, 
HOSTDB_MODULE_MINOR_VERSION , PRIVATE_MODULE_HEADER));
   ink_dns_init(makeModuleVersion(HOSTDB_MODULE_MAJOR_VERSION, 
HOSTDB_MODULE_MINOR_VERSION , PRIVATE_MODULE_HEADER));
   ink_split_dns_init(makeModuleVersion(1, 0, PRIVATE_MODULE_HEADER));
-  eventProcessor.start(num_of_net_threads);
+  eventProcessor.start(num_of_net_threads, stacksize);
 
   int num_remap_threads = 0;
   TS_ReadConfigInteger(num_remap_threads, 
"proxy.config.remap.num_remap_threads");
@@ -1535,9 +1538,9 @@ main(int argc, char **argv)
     Note("using the new remap processor system with %d threads", 
num_remap_threads);
     remapProcessor.setUseSeparateThread();
   }
-  remapProcessor.start(num_remap_threads);
+  remapProcessor.start(num_remap_threads, stacksize);
 
-  RecProcessStart();
+  RecProcessStart(stacksize);
 
   init_signals2();
   // log initialization moved down
@@ -1568,9 +1571,9 @@ main(int argc, char **argv)
       TS_ReadConfigInteger(accept_mss, "proxy.config.net.sock_mss_in");
 
     NetProcessor::accept_mss = accept_mss;
-    netProcessor.start();
+    netProcessor.start(0, stacksize);
 #ifndef INK_NO_HOSTDB
-    dnsProcessor.start();
+    dnsProcessor.start(0, stacksize);
     if (hostDBProcessor.start() < 0)
       SignalWarning(MGMT_SIGNAL_SYSTEM_ERROR, "bad hostdb or storage 
configuration, hostdb disabled");
 #endif
@@ -1590,9 +1593,9 @@ main(int argc, char **argv)
     if (!num_of_udp_threads)
       TS_ReadConfigInteger(num_of_udp_threads, "proxy.config.udp.threads");
     if (num_of_udp_threads)
-      udpNet.start(num_of_udp_threads);
+      udpNet.start(num_of_udp_threads, stacksize);
 
-    sslNetProcessor.start(getNumSSLThreads());
+    sslNetProcessor.start(getNumSSLThreads(), stacksize);
 
 #ifndef INK_NO_LOG
     // initialize logging (after event and net processor)
@@ -1659,7 +1662,7 @@ main(int argc, char **argv)
 #endif
 
     // "Task" processor, possibly with its own set of task threads
-    tasksProcessor.start(num_task_threads);
+    tasksProcessor.start(num_task_threads, stacksize);
 
     int back_door_port = NO_FD;
     TS_ReadConfigInteger(back_door_port, 
"proxy.config.process_manager.mgmt_port");

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/proxy/UglyLogStubs.cc
----------------------------------------------------------------------
diff --git a/proxy/UglyLogStubs.cc b/proxy/UglyLogStubs.cc
index 0456e2b..8701ae7 100644
--- a/proxy/UglyLogStubs.cc
+++ b/proxy/UglyLogStubs.cc
@@ -39,8 +39,7 @@
 int fds_limit = 8000;
 
 class FakeUDPNetProcessor : public UDPNetProcessor {
-  virtual int start(int num) {
-    NOWARN_UNUSED(num);
+  virtual int start(int, size_t) {
     ink_release_assert(false);
     return 0;
   };
@@ -156,9 +155,8 @@ UnixNetProcessor unix_netProcessor;
 NetProcessor& netProcessor = unix_netProcessor;
 
 int
-UnixNetProcessor::start(int num)
+UnixNetProcessor::start(int, size_t)
 {
-  NOWARN_UNUSED(num);
   ink_release_assert(false);
   return 0;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/proxy/http/remap/RemapProcessor.cc
----------------------------------------------------------------------
diff --git a/proxy/http/remap/RemapProcessor.cc 
b/proxy/http/remap/RemapProcessor.cc
index 9a8c717..fc3c14c 100644
--- a/proxy/http/remap/RemapProcessor.cc
+++ b/proxy/http/remap/RemapProcessor.cc
@@ -27,10 +27,10 @@ RemapProcessor remapProcessor;
 extern ClassAllocator<RemapPlugins> pluginAllocator;
 
 int
-RemapProcessor::start(int num_threads)
+RemapProcessor::start(int num_threads, size_t stacksize)
 {
   if (_use_separate_remap_thread)
-    ET_REMAP = eventProcessor.spawn_event_threads(num_threads, "ET_REMAP");  
// ET_REMAP is a class member
+    ET_REMAP = eventProcessor.spawn_event_threads(num_threads, "ET_REMAP", 
stacksize);  // ET_REMAP is a class member
 
   return 0;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/proxy/http/remap/RemapProcessor.h
----------------------------------------------------------------------
diff --git a/proxy/http/remap/RemapProcessor.h 
b/proxy/http/remap/RemapProcessor.h
index c14f6a8..b525ec3 100644
--- a/proxy/http/remap/RemapProcessor.h
+++ b/proxy/http/remap/RemapProcessor.h
@@ -54,7 +54,7 @@ public:
   bool finish_remap(HttpTransact::State * s);
 
   Action *perform_remap(Continuation * cont, HttpTransact::State * s);
-  int start(int num_threads);
+  int start(int num_threads, size_t stacksize);
   bool LessThan(HttpTransact::State *, HttpTransact::State *);
   void setUseSeparateThread() { _use_separate_remap_thread = true; }
   bool using_separate_thread() { return _use_separate_remap_thread == true; }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/proxy/logging/Log.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index b81d727..b672b79 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -1020,6 +1020,9 @@ Log::init_when_enabled()
 void
 Log::create_threads()
 {
+  size_t stacksize;
+
+  REC_ReadConfigInteger(stacksize, "proxy.config.thread.default.stacksize");
   if (!(init_status & THREADS_CREATED)) {
     // start the flush thread
     //
@@ -1028,7 +1031,7 @@ Log::create_threads()
     ink_mutex_init(&flush_mutex, "Flush thread mutex");
     ink_cond_init(&flush_cond);
     Continuation *flush_continuation = NEW(new LoggingFlushContinuation);
-    Event *flush_event = eventProcessor.spawn_thread(flush_continuation, 
"[LOGGING]");
+    Event *flush_event = eventProcessor.spawn_thread(flush_continuation, 
"[LOGGING]", stacksize);
     flush_thread = flush_event->ethread->tid;
 
 #if !defined(IOCORE_LOG_COLLATION)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/92c9140e/proxy/sac.cc
----------------------------------------------------------------------
diff --git a/proxy/sac.cc b/proxy/sac.cc
index 1925113..e858db0 100644
--- a/proxy/sac.cc
+++ b/proxy/sac.cc
@@ -128,9 +128,12 @@ main(int /* argc ATS_UNUSED */, char *argv[])
 
   // initialize the event and net processor
   //
-  eventProcessor.start(ink_number_of_processors());
+  size_t stacksize;
+
+  REC_ReadConfigInteger(stacksize, "proxy.config.thread.default.stacksize");
+  eventProcessor.start(ink_number_of_processors(), stacksize);
   ink_net_init(makeModuleVersion(1, 0, PRIVATE_MODULE_HEADER));
-  netProcessor.start();
+  netProcessor.start(0, stacksize);
   Machine::init();
 
   Log::init(Log::NO_REMOTE_MANAGEMENT | Log::STANDALONE_COLLATOR);

Reply via email to