httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject cvs commit: httpd-2.0/server/mpm/worker worker.c
Date Fri, 24 May 2002 19:50:58 GMT
brianp      02/05/24 12:50:58

  Modified:    .        CHANGES
               server/mpm/worker worker.c
  Log:
  Fix for the worker deadlock problem
  
  Revision  Changes    Path
  1.785     +2 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.784
  retrieving revision 1.785
  diff -u -r1.784 -r1.785
  --- CHANGES	24 May 2002 18:48:09 -0000	1.784
  +++ CHANGES	24 May 2002 19:50:57 -0000	1.785
  @@ -1,5 +1,7 @@
   Changes with Apache 2.0.37
   
  +  *) Fix the worker MPM deadlock problem  [Brian Pane]
  +
     *) Modify the module documentation to allow for translations.
        [Yoshiki Hayashi, Joshua Slive]
   
  
  
  
  1.126     +32 -19    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.125
  retrieving revision 1.126
  diff -u -r1.125 -r1.126
  --- worker.c	23 May 2002 12:58:37 -0000	1.125
  +++ worker.c	24 May 2002 19:50:58 -0000	1.126
  @@ -689,6 +689,7 @@
       apr_pollfd_t *pollset;
       apr_status_t rv;
       ap_listen_rec *lr, *last_lr = ap_listeners;
  +    int have_idle_worker = 0;
   
       free(ti);
   
  @@ -711,18 +712,22 @@
           }
           if (listener_may_exit) break;
   
  -        rv = ap_queue_info_wait_for_idler(worker_queue_info,
  -                                          &recycled_pool);
  -        if (APR_STATUS_IS_EOF(rv)) {
  -            break; /* we've been signaled to die now */
  -        }
  -        else if (rv != APR_SUCCESS) {
  -            ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
  -                         "apr_queue_info_wait failed. Attempting to shutdown "
  -                         "process gracefully.");
  -            signal_threads(ST_GRACEFUL);
  -            break;
  +        if (!have_idle_worker) {
  +            rv = ap_queue_info_wait_for_idler(worker_queue_info,
  +                                              &recycled_pool);
  +            if (APR_STATUS_IS_EOF(rv)) {
  +                break; /* we've been signaled to die now */
  +            }
  +            else if (rv != APR_SUCCESS) {
  +                ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
  +                             "apr_queue_info_wait failed. Attempting to "
  +                             " shutdown process gracefully.");
  +                signal_threads(ST_GRACEFUL);
  +                break;
  +            }
  +            have_idle_worker = 1;
           }
  +            
           /* We've already decremented the idle worker count inside
            * ap_queue_info_wait_for_idler. */
   
  @@ -833,6 +838,9 @@
                       ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf,
                                    "ap_queue_push failed");
                   }
  +                else {
  +                    have_idle_worker = 0;
  +                }
               }
           }
           else {
  @@ -875,6 +883,7 @@
       apr_pool_t *last_ptrans = NULL;
       apr_pool_t *ptrans;                /* Pool for per-transaction stuff */
       apr_status_t rv;
  +    int is_idle = 0;
   
       free(ti);
   
  @@ -883,14 +892,17 @@
       bucket_alloc = apr_bucket_alloc_create(apr_thread_pool_get(thd));
   
       while (!workers_may_exit) {
  -        rv = ap_queue_info_set_idle(worker_queue_info, last_ptrans);
  -        last_ptrans = NULL;
  -        if (rv != APR_SUCCESS) {
  -            ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
  -                         "ap_queue_info_set_idle failed. Attempting to "
  -                         "shutdown process gracefully.");
  -            signal_threads(ST_GRACEFUL);
  -            break;
  +        if (!is_idle) {
  +            rv = ap_queue_info_set_idle(worker_queue_info, last_ptrans);
  +            last_ptrans = NULL;
  +            if (rv != APR_SUCCESS) {
  +                ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
  +                             "ap_queue_info_set_idle failed. Attempting to "
  +                             "shutdown process gracefully.");
  +                signal_threads(ST_GRACEFUL);
  +                break;
  +            }
  +            is_idle = 1;
           }
   
           ap_update_child_status_from_indexes(process_slot, thread_slot, SERVER_READY, NULL);
  @@ -928,6 +940,7 @@
               }
               continue;
           }
  +        is_idle = 0;
           worker_sockets[thread_slot] = csd;
           process_socket(ptrans, csd, process_slot, thread_slot, bucket_alloc);
           worker_sockets[thread_slot] = NULL;
  
  
  

Mime
View raw message