You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mt...@apache.org on 2004/11/29 11:43:30 UTC
svn commit: r106902 - /httpd/httpd/trunk/modules/proxy/proxy_util.c
Author: mturk
Date: Mon Nov 29 02:43:28 2004
New Revision: 106902
URL: http://svn.apache.org/viewcvs?view=rev&rev=106902
Log:
Make sure that worker initialization is done only
once per worker, as well the initialization of shared
memory slot. Also log the child pid so that logging
makes sense.
Modified:
httpd/httpd/trunk/modules/proxy/proxy_util.c
Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
Url: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/proxy_util.c?view=diff&rev=106902&p1=httpd/httpd/trunk/modules/proxy/proxy_util.c&r1=106901&p2=httpd/httpd/trunk/modules/proxy/proxy_util.c&r2=106902
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Mon Nov 29 02:43:28 2004
@@ -1372,6 +1372,11 @@
#else
void *score = NULL;
#endif
+
+ if (worker->s && worker->s->status & PROXY_WORKER_INITIALIZED) {
+ /* The worker share is already initialized */
+ return;
+ }
#if PROXY_HAS_SCOREBOARD
/* Get scoreboard slot */
if (ap_scoreboard_image) {
@@ -1414,7 +1419,14 @@
#if APR_HAS_THREADS
int mpm_threads;
+#endif
+ if (worker->s->status & PROXY_WORKER_INITIALIZED) {
+ /* The worker is already initialized */
+ return APR_SUCCESS;
+ }
+
+#if APR_HAS_THREADS
ap_mpm_query(AP_MPMQ_MAX_THREADS, &mpm_threads);
if (mpm_threads > 1) {
/* Set hard max to no more then mpm_threads */
@@ -1442,8 +1454,9 @@
apr_pool_cleanup_null);
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
- "proxy: initialized worker %d for (%s) min=%d max=%d smax=%d",
- worker->id, worker->hostname, worker->min, worker->hmax, worker->smax);
+ "proxy: initialized worker %d in child %d for (%s) min=%d max=%d smax=%d",
+ worker->id, getpid(), worker->hostname, worker->min,
+ worker->hmax, worker->smax);
#if (APR_MAJOR_VERSION > 0)
/* Set the acquire timeout */
@@ -1457,8 +1470,8 @@
rv = connection_constructor((void **)&(worker->cp->conn), worker, worker->cp->pool);
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
- "proxy: initialized single connection worker %d for (%s)",
- worker->id, worker->hostname);
+ "proxy: initialized single connection worker %d in child %d for (%s)",
+ worker->id, getpid(), worker->hostname);
}
if (rv == APR_SUCCESS)
worker->s->status |= PROXY_WORKER_INITIALIZED;
Re: svn commit: r106902 - /httpd/httpd/trunk/modules/proxy/proxy_util.c
Posted by Jeff Trawick <tr...@gmail.com>.
On 29 Nov 2004 10:43:30 -0000, mturk@apache.org <mt...@apache.org> wrote:
> Author: mturk
> Date: Mon Nov 29 02:43:28 2004
> New Revision: 106902
...
> Also log the child pid so that logging
> makes sense.
...
> --- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
> +++ httpd/httpd/trunk/modules/proxy/proxy_util.c Mon Nov 29 02:43:28 2004
...
> ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
> - "proxy: initialized worker %d for (%s) min=%d max=%d smax=%d",
> - worker->id, worker->hostname, worker->min, worker->hmax, worker->smax);
> + "proxy: initialized worker %d in child %d for (%s) min=%d max=%d smax=%d",
> + worker->id, getpid(), worker->hostname, worker->min,
> + worker->hmax, worker->smax);
need to use
"%" APR_PID_T_FMT
instead of
%d
for the getpid(); pid_t varies between int and long depending on platform
(two places in new code)