From c9476445d9338e831f11efa4843bb2a54985968d Mon Sep 17 00:00:00 2001 From: Bradley Nicholes Date: Tue, 20 May 2003 15:15:23 +0000 Subject: [PATCH] Make sure that bucket allocator for each worker thread is created from a thread specific pool. This prevents multiple threads from trying to clean up the same pool at the same time. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@99942 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/netware/mpm_netware.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/server/mpm/netware/mpm_netware.c b/server/mpm/netware/mpm_netware.c index 3353d4c421..84b46aab29 100644 --- a/server/mpm/netware/mpm_netware.c +++ b/server/mpm/netware/mpm_netware.c @@ -212,12 +212,15 @@ static int volatile wait_to_finish=1; 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 *ptrans, apr_bucket_alloc_t *bucket_alloc) __attribute__ ((noreturn)); -static void clean_child_exit(int code, int worker_num, apr_pool_t *ptrans, apr_bucket_alloc_t *bucket_alloc) +static void clean_child_exit(int code, int worker_num, apr_pool_t *ptrans, + apr_bucket_alloc_t *bucket_alloc, apr_pool_t *pthrd) __attribute__ ((noreturn)); +static void clean_child_exit(int code, int worker_num, apr_pool_t *ptrans, + apr_bucket_alloc_t *bucket_alloc, apr_pool_t *pthrd) { if (!shutdown_pending) { apr_bucket_alloc_destroy(bucket_alloc); apr_pool_destroy(ptrans); + apr_pool_destroy(pthrd); } atomic_dec (&worker_thread_count); @@ -357,7 +360,7 @@ static int avg_retries = 0; void worker_main(void *arg) { ap_listen_rec *lr, *first_lr, *last_lr = NULL; - apr_pool_t *ptrans; + apr_pool_t *ptrans, *pthrd; apr_pool_t *pbucket; apr_allocator_t *allocator; apr_bucket_alloc_t *bucket_alloc; @@ -385,7 +388,10 @@ void worker_main(void *arg) apr_allocator_owner_set(allocator, ptrans); apr_pool_tag(ptrans, "transaction"); - bucket_alloc = apr_bucket_alloc_create(pmain); + apr_pool_create(&pthrd, pmain); + apr_pool_tag(pthrd, "worker_thrd_pool"); + + bucket_alloc = apr_bucket_alloc_create(pthrd); atomic_inc (&worker_thread_count); @@ -398,7 +404,7 @@ void worker_main(void *arg) if ((ap_max_requests_per_child > 0 && requests_this_child++ >= ap_max_requests_per_child)) { - clean_child_exit(0, my_worker_num, ptrans, bucket_alloc); + clean_child_exit(0, my_worker_num, ptrans, bucket_alloc, pthrd); } ap_update_child_status_from_indexes(0, my_worker_num, WORKER_READY, @@ -411,7 +417,7 @@ void worker_main(void *arg) 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, ptrans, bucket_alloc); + clean_child_exit(0, my_worker_num, ptrans, bucket_alloc, pthrd); } /* Check the listen queue on all sockets for requests */ @@ -520,12 +526,13 @@ void worker_main(void *arg) */ ap_log_error(APLOG_MARK, APLOG_EMERG, stat, ap_server_conf, "apr_accept: giving up."); - clean_child_exit(APEXIT_CHILDFATAL, my_worker_num, ptrans, bucket_alloc); + clean_child_exit(APEXIT_CHILDFATAL, my_worker_num, ptrans, + bucket_alloc, pthrd); } else { ap_log_error(APLOG_MARK, APLOG_ERR, stat, ap_server_conf, "apr_accept: (client socket)"); - clean_child_exit(1, my_worker_num, ptrans, bucket_alloc); + clean_child_exit(1, my_worker_num, ptrans, bucket_alloc, pthrd); } } } @@ -544,7 +551,7 @@ void worker_main(void *arg) } request_count++; } - clean_child_exit(0, my_worker_num, ptrans, bucket_alloc); + clean_child_exit(0, my_worker_num, ptrans, bucket_alloc, pthrd); } -- 2.50.1