You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2009/09/16 23:15:07 UTC

svn commit: r815971 - in /httpd/mod_fcgid/trunk: CHANGES-FCGID modules/fcgid/fcgid_bridge.c modules/fcgid/fcgid_conf.c modules/fcgid/fcgid_filter.c

Author: trawick
Date: Wed Sep 16 21:15:04 2009
New Revision: 815971

URL: http://svn.apache.org/viewvc?rev=815971&view=rev
Log:
Use the virtual host settings for the request being processed instead
of those of the first FastCGI request handled by this httpd child process.

Affected directives: 
  BusyTimeout, IPCCommTimeout, IPCConnectTimeout, MaxRequestsPerProcess,
  and OutputBufferSize

Other directives besides IPCCommTimeout could/should be checked
at config time for reasonable values.  The change for IPCCommTimeout
was required by this patch because it removed some compensation for
bad IPCCommTimeout values elsewhere.


Modified:
    httpd/mod_fcgid/trunk/CHANGES-FCGID
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_filter.c

Modified: httpd/mod_fcgid/trunk/CHANGES-FCGID
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/CHANGES-FCGID?rev=815971&r1=815970&r2=815971&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/CHANGES-FCGID [utf8] (original)
+++ httpd/mod_fcgid/trunk/CHANGES-FCGID [utf8] Wed Sep 16 21:15:04 2009
@@ -1,6 +1,11 @@
                                                          -*- coding: utf-8 -*-
 Changes with mod_fcgid 2.3.2
 
+  *) Use the virtual host settings for the request being processed instead
+     of those of the first FastCGI request handled by this httpd child process.
+     Affected directives: BusyTimeout, IPCCommTimeout, IPCConnectTimeout,
+     MaxRequestsPerProcess, and OutputBufferSize.  [Jeff Trawick]
+
   *) The following directives are no longer allowed in a virtual host
      context: BusyScanInterval, DefaultMaxClassProcessCount, 
      DefaultMinProcessCount, ErrorScanInterval, IdleScanInterval, 

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c?rev=815971&r1=815970&r2=815971&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c Wed Sep 16 21:15:04 2009
@@ -33,12 +33,6 @@
 #define FCGID_APPLY_TRY_COUNT 2
 #define FCGID_REQUEST_COUNT 32
 
-static int g_variables_inited = 0;
-static int g_busy_timeout;
-static int g_connect_timeout;
-static int g_comm_timeout;
-static int g_max_requests_per_process;
-
 static fcgid_procnode *apply_free_procnode(server_rec * s,
                                            fcgid_command * command)
 {
@@ -166,6 +160,7 @@
      */
     fcgid_bucket_ctx *ctx = (fcgid_bucket_ctx *) thectx;
     server_rec *s = ctx->ipc.request->server;
+    int max_requests_per_process = get_max_requests_per_process(s);
 
     /* Free bucket buffer */
     if (ctx->buffer) {
@@ -186,7 +181,7 @@
          */
         int dt = (int)
             (apr_time_sec(apr_time_now()) - apr_time_sec(ctx->active_time));
-        if (dt > g_busy_timeout) {
+        if (dt > get_busy_timeout(s)) {
             /* Do nothing but print log */
             ap_log_error(APLOG_MARK, APLOG_INFO, 0, s,
                          "mod_fcgid: process busy timeout, took %d seconds for this request",
@@ -195,9 +190,9 @@
             ctx->procnode->diewhy = FCGID_DIE_COMM_ERROR;
             return_procnode(s, ctx->procnode,
                             1 /* communication error */ );
-        } else if (g_max_requests_per_process != -1
+        } else if (max_requests_per_process != -1
                    && ++ctx->procnode->requests_handled >=
-                   g_max_requests_per_process) {
+                   max_requests_per_process) {
             ctx->procnode->diewhy = FCGID_DIE_LIFETIME_EXPIRED;
             return_procnode(s, ctx->procnode,
                             1 /* handled all requests */ );
@@ -301,20 +296,10 @@
     char sbuf[MAX_STRING_LEN];
     const char *location;
 
-    if (!g_variables_inited) {
-        g_connect_timeout = get_ipc_connect_timeout(r->server);
-        g_comm_timeout = get_ipc_comm_timeout(r->server);
-        g_busy_timeout = get_busy_timeout(r->server);
-        g_max_requests_per_process =
-            get_max_requests_per_process(r->server);
-        if (g_comm_timeout == 0)
-            g_comm_timeout = 1;
-        g_variables_inited = 1;
-    }
-
     bucket_ctx = apr_pcalloc(request_pool, sizeof(*bucket_ctx));
-    bucket_ctx->ipc.connect_timeout = g_connect_timeout;
-    bucket_ctx->ipc.communation_timeout = g_comm_timeout;
+    bucket_ctx->ipc.connect_timeout = get_ipc_connect_timeout(r->server);
+    bucket_ctx->ipc.communation_timeout = get_ipc_comm_timeout(r->server);
+
     bucket_ctx->ipc.request = r;
     apr_pool_cleanup_register(request_pool, bucket_ctx,
                               bucket_ctx_cleanup, apr_pool_cleanup_null);

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c?rev=815971&r1=815970&r2=815971&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c Wed Sep 16 21:15:04 2009
@@ -641,6 +641,9 @@
     fcgid_server_conf *config =
         ap_get_module_config(s->module_config, &fcgid_module);
     config->ipc_comm_timeout = atol(arg);
+    if (config->ipc_comm_timeout < 0) {
+        return "IPCCommTimeout must be greater than 0";
+    }
     return NULL;
 }
 

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_filter.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_filter.c?rev=815971&r1=815970&r2=815971&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_filter.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_filter.c Wed Sep 16 21:15:04 2009
@@ -21,8 +21,6 @@
 #include "fcgid_filter.h"
 #include "fcgid_bucket.h"
 #include "fcgid_conf.h"
-static int g_hasinit = 0;
-static int g_buffsize = 0;
 
 apr_status_t fcgid_filter(ap_filter_t * f, apr_bucket_brigade * bb)
 {
@@ -31,11 +29,7 @@
     int save_size = 0;
     conn_rec *c = f->c;
     server_rec *s = f->r->server;
-
-    if (!g_hasinit) {
-        g_buffsize = get_output_buffersize(s);
-        g_hasinit = 1;
-    }
+    int buffsize = get_output_buffersize(s);
 
     tmp_brigade =
         apr_brigade_create(f->r->pool, f->r->connection->bucket_alloc);
@@ -74,7 +68,7 @@
         APR_BRIGADE_INSERT_TAIL(tmp_brigade, e);
 
         /* I will pass tmp_brigade to next filter if I have got too much buckets */
-        if (save_size > g_buffsize) {
+        if (save_size > buffsize) {
             APR_BRIGADE_INSERT_TAIL(tmp_brigade,
                                     apr_bucket_flush_create(f->r->
                                                             connection->