httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwool...@apache.org
Subject cvs commit: httpd-2.0/server/mpm/worker worker.c
Date Thu, 28 Aug 2003 05:54:44 GMT
jwoolley    2003/08/27 22:54:44

  Modified:    .        CHANGES
               server/mpm/beos beos.c
               server/mpm/experimental/leader leader.c
               server/mpm/experimental/threadpool threadpool.c
               server/mpm/mpmt_os2 mpmt_os2_child.c
               server/mpm/netware mpm_netware.c
               server/mpm/worker worker.c
  Log:
  Updated the various MPM's to use the new bucket_alloc_create_ex API
  when necessary.  Which is to say that it's necessary in all cases except
  for prefork, where the change to apr-util to have it use the allocator
  from the pool passed in is already sufficient.
  
  Reviewed by:	Jean-Jacques Clar, Sander Striker, Brad Nicholes
  
  Revision  Changes    Path
  1.1264    +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1263
  retrieving revision 1.1264
  diff -u -d -u -r1.1263 -r1.1264
  --- CHANGES	25 Aug 2003 03:30:50 -0000	1.1263
  +++ CHANGES	28 Aug 2003 05:54:44 -0000	1.1264
  @@ -2,6 +2,9 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) The bucket brigades subsystem now honors the MaxMemFree setting.
  +     [Cliff Woolley, Jean-Jacques Clar]
  +
     *) Fix mod_include's expression parser to recognize strings correctly
        even if they start with an escaped token.  [André Malo]
   
  
  
  
  1.102     +2 -2      httpd-2.0/server/mpm/beos/beos.c
  
  Index: beos.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/beos/beos.c,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -d -u -r1.101 -r1.102
  --- beos.c	27 Aug 2003 22:33:12 -0000	1.101
  +++ beos.c	28 Aug 2003 05:54:44 -0000	1.102
  @@ -390,6 +390,8 @@
   
       apr_pool_tag(ptrans, "transaction");
   
  +    bucket_alloc = apr_bucket_alloc_create_ex(allocator);
  +
       apr_thread_mutex_lock(worker_thread_count_mutex);
       worker_thread_count++;
       apr_thread_mutex_unlock(worker_thread_count_mutex);
  @@ -400,8 +402,6 @@
       apr_poll_setup(&pollset, num_listening_sockets + 1, tpool);
       for(n=0 ; n <= num_listening_sockets ; n++)
           apr_poll_socket_add(pollset, listening_sockets[n], APR_POLLIN);
  -	
  -    bucket_alloc = apr_bucket_alloc_create(tpool);
   
       while (1) {
           /* If we're here, then chances are (unless we're the first thread created) 
  
  
  
  1.30      +2 -1      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.29
  retrieving revision 1.30
  diff -u -d -u -r1.29 -r1.30
  --- leader.c	27 Aug 2003 22:33:12 -0000	1.29
  +++ leader.c	28 Aug 2003 05:54:44 -0000	1.30
  @@ -715,9 +715,10 @@
   
       apr_allocator_create(&allocator);
       apr_allocator_max_free_set(allocator, ap_max_mem_free);
  +    /* XXX: why is ptrans's parent not tpool?  --jcw 08/2003 */
       apr_pool_create_ex(&ptrans, NULL, NULL, allocator);
       apr_allocator_owner_set(allocator, ptrans);
  -    bucket_alloc = apr_bucket_alloc_create(tpool);
  +    bucket_alloc = apr_bucket_alloc_create_ex(allocator);
   
       apr_poll_setup(&pollset, num_listensocks, tpool);
       for(lr = ap_listeners ; lr != NULL ; lr = lr->next)
  
  
  
  1.18      +2 -4      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.17
  retrieving revision 1.18
  diff -u -d -u -r1.17 -r1.18
  --- threadpool.c	27 Aug 2003 22:33:11 -0000	1.17
  +++ threadpool.c	28 Aug 2003 05:54:44 -0000	1.18
  @@ -981,12 +981,10 @@
   
       apr_allocator_create(&allocator);
       apr_allocator_max_free_set(allocator, ap_max_mem_free);
  +    /* XXX: why is ptrans's parent not tpool? --jcw 08/2003 */
       apr_pool_create_ex(&ptrans, NULL, NULL, allocator);
       apr_allocator_owner_set(allocator, ptrans);
  -
  -    /* XXX: What happens if this is allocated from the
  -     * single-thread-optimized ptrans pool? -aaron */
  -    bucket_alloc = apr_bucket_alloc_create(tpool);
  +    bucket_alloc = apr_bucket_alloc_create_ex(allocator);
   
       wakeup = (worker_wakeup_info *)apr_palloc(tpool, sizeof(*wakeup));
       wakeup->pool = ptrans;
  
  
  
  1.25      +8 -1      httpd-2.0/server/mpm/mpmt_os2/mpmt_os2_child.c
  
  Index: mpmt_os2_child.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/mpmt_os2/mpmt_os2_child.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -d -u -r1.24 -r1.25
  --- mpmt_os2_child.c	3 Feb 2003 17:53:23 -0000	1.24
  +++ mpmt_os2_child.c	28 Aug 2003 05:54:44 -0000	1.25
  @@ -402,6 +402,7 @@
       long conn_id;
       conn_rec *current_conn;
       apr_pool_t *pconn;
  +    apr_allocator_t *allocator;
       apr_bucket_alloc_t *bucket_alloc;
       worker_args_t *worker_args;
       HQUEUE workq;
  @@ -430,10 +431,13 @@
       ap_update_child_status_from_indexes(child_slot, thread_slot, SERVER_READY, 
                                           NULL);
   
  +    apr_allocator_create(&allocator);
  +    apr_allocator_max_free_set(allocator, ap_max_mem_free);
  +    bucket_alloc = apr_bucket_alloc_create_ex(allocator);
  +
       while (rc = DosReadQueue(workq, &rd, &len, (PPVOID)&worker_args, 0, DCWW_WAIT,
&priority, NULLHANDLE),
              rc == 0 && rd.ulData != WORKTYPE_EXIT) {
           pconn = worker_args->pconn;
  -        bucket_alloc = apr_bucket_alloc_create(pconn);
           ap_create_sb_handle(&sbh, pconn, child_slot, thread_slot);
           current_conn = ap_run_create_connection(pconn, ap_server_conf,
                                                   worker_args->conn_sd, conn_id,
  @@ -451,6 +455,9 @@
   
       ap_update_child_status_from_indexes(child_slot, thread_slot, SERVER_DEAD, 
                                           NULL);
  +
  +    apr_bucket_alloc_destroy(bucket_alloc);
  +    apr_allocator_destroy(allocator);
   }
   
   
  
  
  
  1.72      +13 -16    httpd-2.0/server/mpm/netware/mpm_netware.c
  
  Index: mpm_netware.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/netware/mpm_netware.c,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -d -u -r1.71 -r1.72
  --- mpm_netware.c	27 Aug 2003 22:33:12 -0000	1.71
  +++ mpm_netware.c	28 Aug 2003 05:54:44 -0000	1.72
  @@ -212,14 +212,14 @@
   ap_generation_t volatile ap_my_generation=0;
   
   /* a clean exit from a child with proper cleanup */
  -static void clean_child_exit(int code, int worker_num, apr_pool_t *pthrd, 
  +static void clean_child_exit(int code, int worker_num, apr_pool_t *ptrans, 
                                apr_bucket_alloc_t *bucket_alloc) __attribute__ ((noreturn));
  -static void clean_child_exit(int code, int worker_num, apr_pool_t *pthrd, 
  +static void clean_child_exit(int code, int worker_num, apr_pool_t *ptrans, 
                                apr_bucket_alloc_t *bucket_alloc)
   {
  +    apr_bucket_alloc_destroy(bucket_alloc);
       if (!shutdown_pending) {
  -        apr_bucket_alloc_destroy(bucket_alloc);
  -        apr_pool_destroy(pthrd);
  +        apr_pool_destroy(ptrans);
       }
   
       atomic_dec (&worker_thread_count);
  @@ -359,7 +359,7 @@
   void worker_main(void *arg)
   {
       ap_listen_rec *lr, *first_lr, *last_lr = NULL;
  -    apr_pool_t *ptrans, *pthrd;
  +    apr_pool_t *ptrans;
       apr_pool_t *pbucket;
       apr_allocator_t *allocator;
       apr_bucket_alloc_t *bucket_alloc;
  @@ -384,14 +384,11 @@
       apr_allocator_create(&allocator);
       apr_allocator_max_free_set(allocator, ap_max_mem_free);
   
  -    apr_pool_create_ex(&pthrd, pmain, NULL, allocator);
  -    apr_allocator_owner_set(allocator, pthrd);
  -    apr_pool_tag(pthrd, "worker_thrd_pool");
  -
  -    apr_pool_create(&ptrans, pthrd);
  +    apr_pool_create_ex(&ptrans, pmain, NULL, allocator);
  +    apr_allocator_owner_set(allocator, ptrans);
       apr_pool_tag(ptrans, "transaction");
   
  -    bucket_alloc = apr_bucket_alloc_create(pthrd);
  +    bucket_alloc = apr_bucket_alloc_create_ex(allocator);
   
       atomic_inc (&worker_thread_count);
   
  @@ -405,7 +402,7 @@
           if ((ap_max_requests_per_child > 0
               && requests_this_child++ >= ap_max_requests_per_child)) {
               DBPRINT1 ("\n**Thread slot %d is shutting down", my_worker_num);
  -            clean_child_exit(0, my_worker_num, pthrd, bucket_alloc);
  +            clean_child_exit(0, my_worker_num, ptrans, bucket_alloc);
           }
   
           ap_update_child_status_from_indexes(0, my_worker_num, WORKER_READY, 
  @@ -418,7 +415,7 @@
           for (;;) {
               if (shutdown_pending || restart_pending || (ap_scoreboard_image->servers[0][my_worker_num].status
== WORKER_IDLE_KILL)) {
                   DBPRINT1 ("\nThread slot %d is shutting down\n", my_worker_num);
  -                clean_child_exit(0, my_worker_num, pthrd, bucket_alloc);
  +             	 clean_child_exit(0, my_worker_num, ptrans, bucket_alloc);
               }
   
               /* Check the listen queue on all sockets for requests */
  @@ -527,13 +524,13 @@
                           */
                           ap_log_error(APLOG_MARK, APLOG_EMERG, stat, ap_server_conf,
                               "apr_accept: giving up.");
  -                        clean_child_exit(APEXIT_CHILDFATAL, my_worker_num, pthrd, 
  +                        clean_child_exit(APEXIT_CHILDFATAL, my_worker_num, ptrans, 
                                            bucket_alloc);
                   }
                   else {
                           ap_log_error(APLOG_MARK, APLOG_ERR, stat, ap_server_conf,
                               "apr_accept: (client socket)");
  -                        clean_child_exit(1, my_worker_num, pthrd, bucket_alloc);
  +                        clean_child_exit(1, my_worker_num, ptrans, bucket_alloc);
                   }
               }
           }
  @@ -552,7 +549,7 @@
           }
           request_count++;
       }
  -    clean_child_exit(0, my_worker_num, pthrd, bucket_alloc);
  +    clean_child_exit(0, my_worker_num, ptrans, bucket_alloc);
   }
   
   
  
  
  
  1.137     +1 -4      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.136
  retrieving revision 1.137
  diff -u -d -u -r1.136 -r1.137
  --- worker.c	27 Aug 2003 22:33:11 -0000	1.136
  +++ worker.c	28 Aug 2003 05:54:44 -0000	1.137
  @@ -825,8 +825,6 @@
   
       ap_update_child_status_from_indexes(process_slot, thread_slot, SERVER_STARTING, NULL);
   
  -    bucket_alloc = apr_bucket_alloc_create(apr_thread_pool_get(thd));
  -
       while (!workers_may_exit) {
           if (!is_idle) {
               rv = ap_queue_info_set_idle(worker_queue_info, last_ptrans);
  @@ -878,6 +876,7 @@
           }
           is_idle = 0;
           worker_sockets[thread_slot] = csd;
  +        bucket_alloc = apr_bucket_alloc_create(ptrans);
           process_socket(ptrans, csd, process_slot, thread_slot, bucket_alloc);
           worker_sockets[thread_slot] = NULL;
           requests_this_child--; /* FIXME: should be synchronized - aaron */
  @@ -887,8 +886,6 @@
   
       ap_update_child_status_from_indexes(process_slot, thread_slot,
           (dying) ? SERVER_DEAD : SERVER_GRACEFUL, (request_rec *) NULL);
  -
  -    apr_bucket_alloc_destroy(bucket_alloc);
   
       apr_thread_exit(thd, APR_SUCCESS);
       return NULL;
  
  
  

Mime
View raw message