Isn't this the introduction of a memory leak? The threads keep being created, and the pool is _never_ cleared.
Sander > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: 17 April 2002 17:45 > To: [EMAIL PROTECTED] > Subject: cvs commit: httpd-2.0/server/mpm/worker worker.c > > > trawick 02/04/17 08:45:27 > > Modified: server/mpm/worker worker.c > Log: > use an independent pool for threads so that when we abandon them > during graceless termination the cleanups on pchild won't mess with > stuff they are still referencing > > Revision Changes Path > 1.116 +11 -3 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.115 > retrieving revision 1.116 > diff -u -r1.115 -r1.116 > --- worker.c 12 Apr 2002 19:58:52 -0000 1.115 > +++ worker.c 17 Apr 2002 15:45:27 -0000 1.116 > @@ -228,6 +228,10 @@ > > static apr_pool_t *pconf; /* Pool for config stuff */ > static apr_pool_t *pchild; /* Pool for httpd child stuff */ > +static apr_pool_t *thread_pool; /* pool for APR to use for our > + * threads (shouldn't call it > + * pthreads :) ) > + */ > > static pid_t ap_my_pid; /* Linux getpid() doesn't work except in main > thread. Use this instead */ > @@ -916,7 +920,7 @@ > my_info->tid = -1; /* listener thread doesn't have a thread slot */ > my_info->sd = 0; > rv = apr_thread_create(&ts->listener, thread_attr, listener_thread, > - my_info, pchild); > + my_info, thread_pool); > if (rv != APR_SUCCESS) { > ap_log_error(APLOG_MARK, APLOG_ALERT, rv, ap_server_conf, > "apr_thread_create: unable to create listener thread"); > @@ -988,7 +992,7 @@ > * done because it lets us deal with tid better. > */ > rv = apr_thread_create(&threads[i], thread_attr, > - worker_thread, my_info, pchild); > + worker_thread, my_info, thread_pool); > if (rv != APR_SUCCESS) { > ap_log_error(APLOG_MARK, APLOG_ALERT, rv, ap_server_conf, > "apr_thread_create: unable to create worker thread"); > @@ -1118,6 +1122,10 @@ > > ap_my_pid = getpid(); > apr_pool_create(&pchild, pconf); > + /* pool passed to apr_thread_create() can't be cleaned up with pchild > + * since that causes segfaults with graceless termination > + */ > + apr_pool_create(&thread_pool, NULL); > > /*stuff to do before we switch id's, so we have permissions.*/ > ap_reopen_scoreboard(pchild, NULL, 0); > @@ -1182,7 +1190,7 @@ > ts->threadattr = thread_attr; > > rv = apr_thread_create(&start_thread_id, thread_attr, start_threads, > - ts, pchild); > + ts, thread_pool); > if (rv != APR_SUCCESS) { > ap_log_error(APLOG_MARK, APLOG_ALERT, rv, ap_server_conf, > "apr_thread_create: unable to create worker thread");