On Tuesday 22 September 2009 10:39:32 am Jeff Trawick wrote:
> On Tue, Sep 22, 2009 at 12:04 PM, Ricardo Cantu <[email protected]>wrote:
> > I think this patch will do it. See what you think.
>
> Thanks! I think just a couple of tweaks are needed.
>
> Values of -1 for max_requests_per_process need to be fixed at config time
> so that we don't clutter the main logic with migration support. The
> function that handles parsing that directive is
> set_max_requests_per_process() in fcgid_conf.c.
Done.
> Also in that file, DEFAULT_MAX_REQUESTS_PER_PROCESS needs to be 0 instead
> of -1.
Done.
> Then, the check
> + } else if (sconf->max_requests_per_process > 0 // negative and
> zero are unlimited
> doesn't have to be handled differently than the others.
Done.
>
> (BTW, it is a tiny bit helpful to omit generated .html.* from patches.)
>
Sorry, will do.
Index: modules/fcgid/fcgid_pm_main.c
===================================================================
--- modules/fcgid/fcgid_pm_main.c (revision 817674)
+++ modules/fcgid/fcgid_pm_main.c (working copy)
@@ -59,7 +59,8 @@
/* Should I check the idle list now? */
if (procmgr_must_exit()
|| apr_time_sec(now) - apr_time_sec(lastidlescan) <=
- sconf->idle_scan_interval)
+ sconf->idle_scan_interval
+ || (!sconf->idle_timeout && !sconf->proc_lifetime))
return;
lastidlescan = now;
@@ -74,17 +75,17 @@
next_node = &proc_table[current_node->next_index];
last_active_time = current_node->last_active_time;
start_time = current_node->start_time;
- if ((apr_time_sec(now) - apr_time_sec(last_active_time) >
- sconf->idle_timeout
- || apr_time_sec(now) - apr_time_sec(start_time) >
- sconf->proc_lifetime)
+ if (((sconf->idle_timeout && (apr_time_sec(now) - apr_time_sec(last_active_time) >
+ sconf->idle_timeout))
+ || (sconf->proc_lifetime && (apr_time_sec(now) - apr_time_sec(start_time) >
+ sconf->proc_lifetime)))
&& is_kill_allowed(main_server, current_node)) {
/* Set die reason for log */
- if (apr_time_sec(now) - apr_time_sec(last_active_time) >
- sconf->idle_timeout)
+ if (sconf->idle_timeout && (apr_time_sec(now) - apr_time_sec(last_active_time) >
+ sconf->idle_timeout))
current_node->diewhy = FCGID_DIE_IDLE_TIMEOUT;
- else if (apr_time_sec(now) - apr_time_sec(start_time) >
- sconf->proc_lifetime)
+ else if (sconf->proc_lifetime && (apr_time_sec(now) - apr_time_sec(start_time) >
+ sconf->proc_lifetime))
current_node->diewhy = FCGID_DIE_LIFETIME_EXPIRED;
/* Unlink from idle list */
Index: modules/fcgid/fcgid_conf.c
===================================================================
--- modules/fcgid/fcgid_conf.c (revision 817674)
+++ modules/fcgid/fcgid_conf.c (working copy)
@@ -47,7 +47,7 @@
#define DEFAULT_IPC_CONNECT_TIMEOUT 3
#define DEFAULT_IPC_COMM_TIMEOUT 40
#define DEFAULT_OUTPUT_BUFFERSIZE 65536
-#define DEFAULT_MAX_REQUESTS_PER_PROCESS -1
+#define DEFAULT_MAX_REQUESTS_PER_PROCESS 0
#define DEFAULT_MAX_REQUEST_LEN (1024*1024*1024) /* 1G */
#define DEFAULT_MAX_MEM_REQUEST_LEN (1024*64) /* 64k */
#define DEFAULT_WRAPPER_KEY "ALL"
@@ -472,7 +472,9 @@
server_rec *s = cmd->server;
fcgid_server_conf *config =
ap_get_module_config(s->module_config, &fcgid_module);
- config->max_requests_per_process = atol(arg);
+ if ((config->max_requests_per_process = atol(arg)) == -1) {
+ config->max_requests_per_process = 0;
+ }
config->max_requests_per_process_set = 1;
return NULL;
}
Index: modules/fcgid/fcgid_bridge.c
===================================================================
--- modules/fcgid/fcgid_bridge.c (revision 817674)
+++ modules/fcgid/fcgid_bridge.c (working copy)
@@ -193,7 +193,7 @@
ctx->procnode->diewhy = FCGID_DIE_COMM_ERROR;
return_procnode(s, ctx->procnode,
1 /* communication error */ );
- } else if (sconf->max_requests_per_process != -1
+ } else if (sconf->max_requests_per_process
&& ++ctx->procnode->requests_handled >=
sconf->max_requests_per_process) {
ctx->procnode->diewhy = FCGID_DIE_LIFETIME_EXPIRED;