I think this patch will do it. See what you think.

On Tuesday 22 September 2009 8:15:12 am Jeff Trawick wrote:
> On Tue, Sep 22, 2009 at 9:34 AM, Ricardo Cantu <rica...@smartcsc.com> wrote:
> > On Tuesday 22 September 2009 7:03:36 am Jeff Trawick wrote:
> > > I think this may work for you:
> > >
> > > DefaultMinClassProcessCount 1
> > > DefaultMaxClassProcessCount 1
> > > IdleTimeout 2147483647
> > > ProcessLifetime 2147483647
> > >
> > > Those magic values for IdleTimeout and ProcessLifetime are as close to
> > > "unlimited" as you can get with the current code.
> > >
> > > Note that these can only be set globally with mod_fcgid.  That's
> > > probably
> >
> > a
> >
> > > much bigger problem than the "unlimited" hack.
> >
> > It's seem very reasonable to have "0" (unlimited) as valid value for
> > killInterval, IdleTimeout, and ProcessLifetime. As I don't think the
> > actual time of zero seconds would make sense in any of those variables.
> >
> > Any objections to such a patch?
> 
> I think it is perfectly fine to allow IdleTimeout and ProcessLifetime to
> accept 0 and treat it as unlimited.*
> 
> Did you mean IdleScanInterval instead of killInterval?  IMO it isn't so
> useful to disable the various scans.
> 
> --/--
> 
> *Currently one of the other directives uses -1 as unlimited.  We should
> change that one to also use 0 as unlimited, but allow -1 during a migration
> period so that existing configurations work.
> 
> Note also that we've renamed the directives but continue to support the old
> ones.  The new directive names in the current source code and documented at
> http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html#upgrade are just a
> rough draft.  They'll be tweaked further before GA.
> 

Index: docs/manual/mod/mod_fcgid.html.en
===================================================================
--- docs/manual/mod/mod_fcgid.html.en	(revision 817674)
+++ docs/manual/mod/mod_fcgid.html.en	(working copy)
@@ -25,8 +25,8 @@
 </div>
 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Provides for execution of FastCGI applications</td></tr>
 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>External</td></tr>
-<tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>fcgid_module</td></tr>
-<tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_fcgid.c</td></tr>
+<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>fcgid_module</td></tr>
+<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>mod_fcgid.c</td></tr>
 <tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Apache 2.0 and higher</td></tr></table>
 <h3>Summary</h3>
 
@@ -677,7 +677,8 @@
 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_fcgid</td></tr>
 </table>
       <p>Application processes which have not handled a request
-      for this period of time will be terminated.</p>
+for this period of time will be terminated. A value of <code>0</code>
+disables the check.</p>
     
 </div>
 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
@@ -767,13 +768,13 @@
 <table class="directive">
 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Max requests handled by each FastCGI application</td></tr>
 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>FCGIDMaxRequestsPerProcess <em>value</em></code></td></tr>
-<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>FCGIDMaxRequestsPerProcess -1</code></td></tr>
+<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>FCGIDMaxRequestsPerProcess 0</code></td></tr>
 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>External</td></tr>
 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_fcgid</td></tr>
 </table>
       <p>FastCGI application processes will be terminated after handling
-      the specified number of requests.  A value of <code>-1</code>
+      the specified number of requests.  A value of <code>0</code>
       disables the check.</p>
     
 </div>
@@ -835,7 +836,8 @@
 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_fcgid</td></tr>
 </table>
       <p>Idle application processes which have existed for greater
-      than this time will be terminated.</p>
+than this time will be terminated. A value of <code>0</code>
+disables the check.</p>
     
 </div>
 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
Index: docs/manual/mod/mod_fcgid.xml
===================================================================
--- docs/manual/mod/mod_fcgid.xml	(revision 817674)
+++ docs/manual/mod/mod_fcgid.xml	(working copy)
@@ -606,7 +606,8 @@
     <contextlist><context>server config</context></contextlist>
     <usage>
       <p>Application processes which have not handled a request
-      for this period of time will be terminated.</p>
+        for this period of time will be terminated. A value of <code>0</code>
+      disables the check.</p>
     </usage>
   </directivesynopsis>
 
@@ -686,11 +687,11 @@
     <name>FCGIDMaxRequestsPerProcess</name>
     <description>Max requests handled by each FastCGI application</description>
     <syntax>FCGIDMaxRequestsPerProcess <em>value</em></syntax>
-    <default>FCGIDMaxRequestsPerProcess -1</default>
+    <default>FCGIDMaxRequestsPerProcess 0</default>
     <contextlist><context>server config</context> <context>virtual host</context></contextlist>
     <usage>
       <p>FastCGI application processes will be terminated after handling
-      the specified number of requests.  A value of <code>-1</code>
+      the specified number of requests.  A value of <code>0</code>
       disables the check.</p>
     </usage>
   </directivesynopsis>
@@ -744,7 +745,8 @@
     <contextlist><context>server config</context></contextlist>
     <usage>
       <p>Idle application processes which have existed for greater
-      than this time will be terminated.</p>
+        than this time will be terminated. A value of <code>0</code>
+      disables the check.</p>
     </usage>
   </directivesynopsis>
 
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_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 > 0    // negative and zero are unlimited
                    && ++ctx->procnode->requests_handled >=
                    sconf->max_requests_per_process) {
             ctx->procnode->diewhy = FCGID_DIE_LIFETIME_EXPIRED;

Reply via email to