httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brad Nicholes" <BNICHO...@novell.com>
Subject Re: cvs commit: httpd-2.0/server/mpm/worker mpm.h worker.c
Date Mon, 15 Mar 2004 19:15:46 GMT
   NetWare has a directive called ThreadStackSize which has been in use
for a number of years.  The main reason for this directive on NetWare
was due to the fixed stack in the OS.  Would it make more sense to call
the new directive ThreadStackSize rather than WorkerStackSize to avoid
two different directive names with similar functionality?

Brad

Brad Nicholes
Senior Software Engineer
Novell, Inc., the leading provider of Net business solutions
http://www.novell.com 

>>> trawick@apache.org Wednesday, March 10, 2004 8:57:50 PM >>>
trawick     2004/03/10 19:57:50

  Modified:    .        CHANGES
               include  mpm_common.h
               server   core.c mpm_common.c
               server/mpm/experimental/leader leader.c mpm.h
               server/mpm/experimental/perchild mpm.h perchild.c
               server/mpm/experimental/threadpool mpm.h threadpool.c
               server/mpm/winnt child.c mpm.h
               server/mpm/worker mpm.h worker.c
  Log:
  Threaded MPMs for Unix and Win32: Add WorkerStackSize directive
  to override default thread stack size for threads which handle
  client connections.  Required for some third-party modules on
  platforms with small default thread stack size.
  
  This is also useful for trimming back the stack size on
  platforms with relatively large default stack size in order to
  conserve address space for supporting more threads per child.
  
  Revision  Changes    Path
  1.1421    +6 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1420
  retrieving revision 1.1421
  diff -u -r1.1420 -r1.1421
  --- CHANGES	10 Mar 2004 15:05:51 -0000	1.1420
  +++ CHANGES	11 Mar 2004 03:57:49 -0000	1.1421
  @@ -1,6 +1,12 @@
   Changes with Apache 2.1.0-dev
   
     [Remove entries to the current 2.0 section below, when
backported]
  +
  +  *) Threaded MPMs for Unix and Win32: Add WorkerStackSize
directive
  +     to override default thread stack size for threads which handle
  +     client connections.  Required for some third-party modules on
  +     platforms with small default thread stack size.  [Jeff
Trawick]
  +
     *) Win32: Tweak worker thread accounting routines to eliminate
        server hang when number of Listen directives in httpd.conf
        is greater than or equal to the setting of ThreadsPerChild.
  
  
  
  1.48      +6 -0      httpd-2.0/include/mpm_common.h
  
  Index: mpm_common.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/mpm_common.h,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- mpm_common.h	6 Mar 2004 14:50:55 -0000	1.47
  +++ mpm_common.h	11 Mar 2004 03:57:49 -0000	1.48
  @@ -248,6 +248,12 @@
                                              const char *arg);
   #endif
   
  +#ifdef AP_MPM_WANT_SET_STACKSIZE
  +extern apr_size_t ap_worker_stacksize;
  +extern const char *ap_mpm_set_worker_stacksize(cmd_parms *cmd, void
*dummy,
  +                                               const char *arg);
  +#endif
  +
   #ifdef AP_MPM_WANT_FATAL_SIGNAL_HANDLER
   extern apr_status_t ap_fatal_signal_setup(server_rec *s, apr_pool_t
*pconf);
   extern apr_status_t ap_fatal_signal_child_setup(server_rec *s);
  
  
  
  1.265     +4 -0      httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.264
  retrieving revision 1.265
  diff -u -r1.264 -r1.265
  --- core.c	1 Mar 2004 21:40:44 -0000	1.264
  +++ core.c	11 Mar 2004 03:57:49 -0000	1.265
  @@ -3225,6 +3225,10 @@
   AP_INIT_TAKE1("MaxMemFree", ap_mpm_set_max_mem_free, NULL,
RSRC_CONF,
                 "Maximum number of 1k blocks a particular childs
allocator may hold."),
   #endif
  +#ifdef AP_MPM_WANT_SET_STACKSIZE
  +AP_INIT_TAKE1("WorkerStackSize", ap_mpm_set_worker_stacksize, NULL,
RSRC_CONF,
  +              "Size in bytes of stack used by threads handling
client connections"),
  +#endif
   #if AP_ENABLE_EXCEPTION_HOOK
   AP_INIT_TAKE1("EnableExceptionHook", ap_mpm_set_exception_hook,
NULL, RSRC_CONF,
                 "Controls whether exception hook may be called after a
crash"),
  
  
  
  1.119     +24 -0     httpd-2.0/server/mpm_common.c
  
  Index: mpm_common.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm_common.c,v
  retrieving revision 1.118
  retrieving revision 1.119
  diff -u -r1.118 -r1.119
  --- mpm_common.c	6 Mar 2004 14:50:55 -0000	1.118
  +++ mpm_common.c	11 Mar 2004 03:57:49 -0000	1.119
  @@ -870,6 +870,30 @@
   
   #endif /* AP_MPM_WANT_SET_MAX_MEM_FREE */
   
  +#ifdef AP_MPM_WANT_SET_STACKSIZE
  +apr_size_t ap_worker_stacksize = 0; /* use system default */
  +
  +const char *ap_mpm_set_worker_stacksize(cmd_parms *cmd, void
*dummy,
  +                                        const char *arg)
  +{
  +    long value;
  +    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
  +    if (err != NULL) {
  +        return err;
  +    }
  +    
  +    value = strtol(arg, NULL, 0);
  +    if (value < 0 || errno == ERANGE)
  +        return apr_pstrcat(cmd->pool, "Invalid WorkerStackSize
value: ", 
  +                           arg, NULL);
  +
  +    ap_worker_stacksize = (apr_size_t)value;
  +
  +    return NULL;
  +}
  +
  +#endif /* AP_MPM_WANT_SET_STACKSIZE */
  +
   #ifdef AP_MPM_WANT_FATAL_SIGNAL_HANDLER
   
   static pid_t parent_pid, my_pid;
  
  
  
  1.41      +3 -0     
httpd-2.0/server/mpm/experimental/leader/leader.c
  
  Index: leader.c
  ===================================================================
  RCS file:
/home/cvs/httpd-2.0/server/mpm/experimental/leader/leader.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- leader.c	9 Feb 2004 20:40:50 -0000	1.40
  +++ leader.c	11 Mar 2004 03:57:49 -0000	1.41
  @@ -1074,6 +1074,9 @@
       apr_threadattr_create(&thread_attr, pchild);
       /* 0 means PTHREAD_CREATE_JOINABLE */
       apr_threadattr_detach_set(thread_attr, 0);
  +    if (ap_worker_stacksize != 0) {
  +        apr_threadattr_stacksize_set(thread_attr,
ap_worker_stacksize);
  +    }
   
       ts->threads = threads;
       ts->child_num_arg = child_num_arg;
  
  
  
  1.13      +1 -0      httpd-2.0/server/mpm/experimental/leader/mpm.h
  
  Index: mpm.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/experimental/leader/mpm.h,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- mpm.h	9 Feb 2004 20:40:50 -0000	1.12
  +++ mpm.h	11 Mar 2004 03:57:49 -0000	1.13
  @@ -34,6 +34,7 @@
   #define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
   #define AP_MPM_WANT_SIGNAL_SERVER
   #define AP_MPM_WANT_SET_MAX_MEM_FREE
  +#define AP_MPM_WANT_SET_STACKSIZE
   #define AP_MPM_WANT_FATAL_SIGNAL_HANDLER
   #define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
   
  
  
  
  1.23      +1 -0     
httpd-2.0/server/mpm/experimental/perchild/mpm.h
  
  Index: mpm.h
  ===================================================================
  RCS file:
/home/cvs/httpd-2.0/server/mpm/experimental/perchild/mpm.h,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- mpm.h	9 Feb 2004 20:40:50 -0000	1.22
  +++ mpm.h	11 Mar 2004 03:57:50 -0000	1.23
  @@ -34,6 +34,7 @@
   #define AP_MPM_WANT_SET_COREDUMPDIR
   #define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
   #define AP_MPM_WANT_SIGNAL_SERVER
  +#define AP_MPM_WANT_SET_STACKSIZE
   #define AP_MPM_WANT_FATAL_SIGNAL_HANDLER
   #define AP_MPM_USES_POD
   
  
  
  
  1.146     +3 -1     
httpd-2.0/server/mpm/experimental/perchild/perchild.c
  
  Index: perchild.c
  ===================================================================
  RCS file:
/home/cvs/httpd-2.0/server/mpm/experimental/perchild/perchild.c,v
  retrieving revision 1.145
  retrieving revision 1.146
  diff -u -r1.145 -r1.146
  --- perchild.c	9 Feb 2004 20:40:50 -0000	1.145
  +++ perchild.c	11 Mar 2004 03:57:50 -0000	1.146
  @@ -982,7 +982,9 @@
                       APR_THREAD_MUTEX_DEFAULT, pchild);
   
       apr_threadattr_create(&worker_thread_attr, pchild);
  -    apr_threadattr_detach_set(worker_thread_attr, 1);               
                     
  +    apr_threadattr_detach_set(worker_thread_attr, 1);               
               if (ap_worker_stacksize != 0) {
  +        apr_threadattr_stacksize_set(thread_attr,
ap_worker_stacksize);
  +    }
   
       /* We are creating worker threads right now */
       for (i=0; i < threads_to_start; i++) {
  
  
  
  1.10      +1 -0     
httpd-2.0/server/mpm/experimental/threadpool/mpm.h
  
  Index: mpm.h
  ===================================================================
  RCS file:
/home/cvs/httpd-2.0/server/mpm/experimental/threadpool/mpm.h,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- mpm.h	9 Feb 2004 20:40:51 -0000	1.9
  +++ mpm.h	11 Mar 2004 03:57:50 -0000	1.10
  @@ -34,6 +34,7 @@
   #define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
   #define AP_MPM_WANT_SIGNAL_SERVER
   #define AP_MPM_WANT_SET_MAX_MEM_FREE
  +#define AP_MPM_WANT_SET_STACKSIZE
   #define AP_MPM_WANT_FATAL_SIGNAL_HANDLER
   #define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
   
  
  
  
  1.29      +3 -0     
httpd-2.0/server/mpm/experimental/threadpool/threadpool.c
  
  Index: threadpool.c
  ===================================================================
  RCS file:
/home/cvs/httpd-2.0/server/mpm/experimental/threadpool/threadpool.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- threadpool.c	9 Feb 2004 20:40:51 -0000	1.28
  +++ threadpool.c	11 Mar 2004 03:57:50 -0000	1.29
  @@ -1289,6 +1289,9 @@
       apr_threadattr_create(&thread_attr, pchild);
       /* 0 means PTHREAD_CREATE_JOINABLE */
       apr_threadattr_detach_set(thread_attr, 0);
  +    if (ap_worker_stacksize != 0) {
  +        apr_threadattr_stacksize_set(thread_attr,
ap_worker_stacksize);
  +    }
   
       ts->threads = threads;
       ts->listener = NULL;
  
  
  
  1.34      +2 -1      httpd-2.0/server/mpm/winnt/child.c
  
  Index: child.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/child.c,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- child.c	10 Mar 2004 15:05:52 -0000	1.33
  +++ child.c	11 Mar 2004 03:57:50 -0000	1.34
  @@ -928,7 +928,8 @@
                   continue;
               }
               ap_update_child_status_from_indexes(0, i,
SERVER_STARTING, NULL);
  -            child_handles[i] = (HANDLE) _beginthreadex(NULL, 0,
(LPTHREAD_START_ROUTINE) worker_main,
  +            child_handles[i] = (HANDLE) _beginthreadex(NULL,
(unsigned)ap_worker_stacksize,
  +                                                      
(LPTHREAD_START_ROUTINE) worker_main,
                                                          (void *) i,
0, &tid);
               if (child_handles[i] == 0) {
                   ap_log_error(APLOG_MARK, APLOG_CRIT,
apr_get_os_error(), ap_server_conf,
  
  
  
  1.18      +1 -0      httpd-2.0/server/mpm/winnt/mpm.h
  
  Index: mpm.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/mpm.h,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- mpm.h	9 Feb 2004 20:40:51 -0000	1.17
  +++ mpm.h	11 Mar 2004 03:57:50 -0000	1.18
  @@ -30,6 +30,7 @@
   #define AP_MPM_WANT_SET_COREDUMPDIR
   #define AP_MPM_WANT_SET_SCOREBOARD
   #define AP_MPM_WANT_SET_MAX_MEM_FREE
  +#define AP_MPM_WANT_SET_STACKSIZE
   
   extern int ap_threads_per_child;
   extern int ap_thread_limit;
  
  
  
  1.21      +1 -0      httpd-2.0/server/mpm/worker/mpm.h
  
  Index: mpm.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/worker/mpm.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- mpm.h	9 Feb 2004 20:40:52 -0000	1.20
  +++ mpm.h	11 Mar 2004 03:57:50 -0000	1.21
  @@ -34,6 +34,7 @@
   #define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
   #define AP_MPM_WANT_SIGNAL_SERVER
   #define AP_MPM_WANT_SET_MAX_MEM_FREE
  +#define AP_MPM_WANT_SET_STACKSIZE
   #define AP_MPM_WANT_FATAL_SIGNAL_HANDLER
   #define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
   
  
  
  
  1.150     +4 -0      httpd-2.0/server/mpm/worker/worker.c
  
  Index: worker.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/worker/worker.c,v
  retrieving revision 1.149
  retrieving revision 1.150
  diff -u -r1.149 -r1.150
  --- worker.c	9 Feb 2004 20:40:52 -0000	1.149
  +++ worker.c	11 Mar 2004 03:57:50 -0000	1.150
  @@ -1164,6 +1164,10 @@
       /* 0 means PTHREAD_CREATE_JOINABLE */
       apr_threadattr_detach_set(thread_attr, 0);
   
  +    if (ap_worker_stacksize != 0) {
  +        apr_threadattr_stacksize_set(thread_attr,
ap_worker_stacksize);
  +    }
  +    
       ts->threads = threads;
       ts->listener = NULL;
       ts->child_num_arg = child_num_arg;
  
  
  

Mime
View raw message