httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject cvs commit: httpd-2.0/server/mpm/worker worker.c
Date Wed, 01 May 2002 07:15:40 GMT
jerenkrantz    02/05/01 00:15:40

  Modified:    .        CHANGES
               server/mpm/worker worker.c
  Log:
  Close sockets on worker MPM when doing a graceless restart.  This should
  resolve some segfaults see when doing such restarts.
  
  (Justin tweaked the palloc/memset in favor of calloc.)
  
  Submitted by:	Aaron Bannert
  Reviewed by:	Greg Ames, Sander Striker, Justin Erenkrantz
  
  Revision  Changes    Path
  1.750     +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.749
  retrieving revision 1.750
  diff -u -r1.749 -r1.750
  --- CHANGES	30 Apr 2002 17:10:11 -0000	1.749
  +++ CHANGES	1 May 2002 07:15:39 -0000	1.750
  @@ -1,5 +1,8 @@
   Changes with Apache 2.0.37
   
  +  *) Close sockets on worker MPM when doing a graceless restart.
  +     [Aaron Bannert]
  +
     *) Reverted a minor optimization in mod_ssl.c that used the vhost ID
        as the session id context rather that a MD5 hash of that vhost ID,
        because it caused very long vhost id's to be unusable with mod_ssl.
  
  
  
  1.121     +21 -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.120
  retrieving revision 1.121
  diff -u -r1.120 -r1.121
  --- worker.c	28 Apr 2002 22:13:32 -0000	1.120
  +++ worker.c	1 May 2002 07:15:39 -0000	1.121
  @@ -252,6 +252,21 @@
    */
   #define LISTENER_SIGNAL     SIGHUP
   
  +/* An array of socket descriptors in use by each thread used to
  + * perform a non-graceful (forced) shutdown of the server. */
  +static apr_socket_t **worker_sockets;
  +
  +static void close_worker_sockets(void)
  +{
  +    int i;
  +    for (i = 0; i < ap_threads_per_child; i++) {
  +        if (worker_sockets[i]) {
  +            apr_socket_close(worker_sockets[i]);
  +            worker_sockets[i] = NULL;
  +        }
  +    }
  +}
  +  
   static void wakeup_listener(void)
   {
       listener_may_exit = 1;
  @@ -301,6 +316,7 @@
           workers_may_exit = 1;
           ap_queue_interrupt_all(worker_queue);
           ap_queue_info_term(worker_queue_info);
  +        close_worker_sockets(); /* forcefully kill all current connections */
       }
   }
   
  @@ -912,7 +928,9 @@
               }
               continue;
           }
  +        worker_sockets[thread_slot] = csd;
           process_socket(ptrans, csd, process_slot, thread_slot, bucket_alloc);
  +        worker_sockets[thread_slot] = NULL;
           requests_this_child--; /* FIXME: should be synchronized - aaron */
           apr_pool_clear(ptrans);
           last_ptrans = ptrans;
  @@ -1001,6 +1019,9 @@
                        "ap_queue_info_create() failed");
           clean_child_exit(APEXIT_CHILDFATAL);
       }
  +
  +    worker_sockets = apr_pcalloc(pchild, ap_threads_per_child
  +                                        * sizeof(apr_socket_t *));
   
       loops = prev_threads_created = 0;
       while (1) {
  
  
  

Mime
View raw message