https://issues.apache.org/bugzilla/show_bug.cgi?id=48981

--- Comment #4 from [email protected] 2010-03-26 08:11:19 UTC ---
I just discovered the same problem on Fedora 11 (mod_fcgid 2.2).  The following
patch solves the concrete problem, but it should not be considered as proposed
one.  It works for me, so it may be used as temporary solution.

In the patch I just move check of amount of run processes into beginning of
is_spawn_allowed function.

My guess is there is some race condition (the situation that I see in logs
leads me to that).  I've seen in logs the lines like "mod_fcgid: XXXXX total
process count 195 >= 20, skip the spawn request" where "195" can be "25",
"201", "345" etc (I have 600 VirtualHosts and MaxProcessCount set to 20), i.e.
sometimes Apache permit spawn of new process, sometimes - not.  The probability
of permitting is low if amount of http queries (on different VritualHosts) is
high.

I've looked on fcgid_proctbl_unix.c and found line "g_proc_array =
_global_memory->procnode_array;" (g_proc_array used in is_spawn_allowed via
g_stat_list_header), if _global_memory not set before this line, it may cause
the issue I see.

Sorry if I completely wrong with my guesses, I just want to share my experience
with this problem.  I have no experience with system programming at all (an I
have no C knowledge), so please don't trust me ;)



PS: the patch:
$ diff -u fcgid_spawn_ctl.c.orig fcgid_spawn_ctl.c
--- fcgid_spawn_ctl.c.orig    2010-03-26 13:33:36.000000000 +0600
+++ fcgid_spawn_ctl.c    2010-03-26 13:34:13.000000000 +0600
@@ -146,6 +146,14 @@
     if (!command || !g_stat_pool)
         return 1;

+        /* Total process count higher than up limit? */
+        if (g_total_process >= g_max_process) {
+          ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, main_server,
+                       "mod_fcgid: %s total process count %d >= %d, skip the
spawn request",
+                       command->cgipath, g_total_process, g_max_process);
+          return 0;
+        }
+
     /* Can I find the node base on inode, device id and share group id? */
     for (current_node = g_stat_list_header;
          current_node != NULL; current_node = current_node->next) {
@@ -180,14 +188,6 @@
             return 0;
         }

-        /* Total process count higher than up limit? */
-        if (g_total_process >= g_max_process) {
-            ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, main_server,
-                         "mod_fcgid: %s total process count %d >= %d, skip the
spawn request",
-                         command->cgipath, g_total_process, g_max_process);
-            return 0;
-        }
-
         /*
            Process count of this class higher than up limit?
          */

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to