httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grega...@apache.org
Subject cvs commit: httpd-2.0/server/mpm/threaded threaded.c
Date Fri, 11 May 2001 10:54:26 GMT
gregames    01/05/11 03:54:25

  Modified:    server/mpm/threaded threaded.c
  Log:
  revert to the documented behavior of MaxRequestPerChild 0, but keep the
  hot path simplification.
  
  Revision  Changes    Path
  1.31      +36 -10    httpd-2.0/server/mpm/threaded/threaded.c
  
  Index: threaded.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/threaded/threaded.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -d -b -u -r1.30 -r1.31
  --- threaded.c	2001/05/07 18:41:50	1.30
  +++ threaded.c	2001/05/11 10:54:21	1.31
  @@ -437,6 +437,32 @@
           ap_lingering_close(current_conn);
       }
   }
  +
  +/* requests_this_child has gone to zero or below.  See if the admin coded
  +   "MaxRequestsPerChild 0", and keep going in that case.  Doing it this way
  +   simplifies the hot path in worker_thread */
  +
  +static void check_infinite_requests(void)
  +{
  +    if (ap_max_requests_per_child) {
  +        workers_may_exit = 1;              
  +    }
  +    else {
  +        /* wow! if you're executing this code, you may have set a record.
  +         * either this child process has served over 2 billion requests, or
  +         * you're running a threaded 2.0 on a 16 bit machine.  
  +         *
  +         * I'll buy pizza and beers at Apachecon for the first person to do
  +         * the former without cheating (dorking with INT_MAX, or running with
  +         * uncommitted performance patches, for example).    
  +         *
  +         * for the latter case, you probably deserve a beer too.   Greg Ames
  +         */
  +            
  +        requests_this_child = INT_MAX;      /* keep going */ 
  +    }
  +}
  +
   /* Sets workers_may_exit if we received a character on the pipe_of_death */
   static void check_pipe_of_death(void)
   {
  @@ -489,7 +515,9 @@
       /* TODO: Switch to a system where threads reuse the results from earlier
          poll calls - manoj */
       while (1) {
  -        workers_may_exit |= (requests_this_child <= 0);
  +        if (requests_this_child <= 0) {
  +            check_infinite_requests();
  +        }
           if (workers_may_exit) break;
   
           (void) ap_update_child_status(process_slot, thread_slot, SERVER_READY, 
  @@ -648,7 +676,13 @@
           clean_child_exit(APEXIT_CHILDFATAL);
       }
   
  +    if (ap_max_requests_per_child) {
       requests_this_child = ap_max_requests_per_child;
  +    }
  +    else {
  +        /* coding a value of zero means infinity */
  +        requests_this_child = INT_MAX;
  +    }
       
       /* Set up the pollfd array */
       listensocks = apr_pcalloc(pchild,
  @@ -1379,14 +1413,6 @@
       }
   
       ap_max_requests_per_child = atoi(arg);
  -    
  -    /* a value of zero means infinity.  The following removes a conditional
  -     * from worker_thread's hot path 
  -     */
  -     
  -    if (!ap_max_requests_per_child) {
  -        ap_max_requests_per_child = INT_MAX; 
  -    }
   
       return NULL;
   }
  
  
  

Mime
View raw message