logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Third-party Modules View previous topic :: View next topic
Reply to topic   Topic: mod_fcgid 2.2 graceful restart bug back in mod_fcgid 2.3.x Page Previous  1, 2, 3  Next
Author
flatcircle



Joined: 27 Jun 2006
Posts: 79

PostPosted: Fri 12 Nov '10 14:05    Post subject: Reply with quote

So, I guess for the moment, the best choice is to use mod_fcgid 2.3.5b instead of 2.3.6, right?
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Sat 13 Nov '10 9:02    Post subject: Reply with quote

In my opinion.

Actually ... 2.3.6 is much friendlier ... until php brings down fcgid, which for me brings down Apache ... so I am sticking with 235b for the time being.

My public facing Apache/2.3.8 lasted ~ 28-30 hours before it happened with mod_fcgid/2.3.6
Back to top
flatcircle



Joined: 27 Jun 2006
Posts: 79

PostPosted: Sat 13 Nov '10 17:45    Post subject: Reply with quote

I never used mod_fcgid on my server before.

Just tried mod_fcgid 2.3.6 with the following config:

Code:
<IfModule fcgid_module>
FcgidInitialEnv PATH "c:/php;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;"
FcgidInitialEnv SystemRoot "C:/Windows"
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:/WINDOWS/Temp"
FcgidInitialEnv TMP "C:/WINDOWS/Temp"
FcgidInitialEnv windir "C:/WINDOWS"

FcgidIOTimeout 40
FcgidConnectTimeout 10
FcgidMaxProcesses 8
FcgidOutputBufferSize 64
ProcessLifeTime 240
FcgidMaxRequestsPerProcess 500
FcgidMinProcessesPerClass 0

<Files ~ "\.php$>"
    AddHandler fcgid-script .php
    SetEnv PHPRC "C:/php"   
   FcgidWrapper "C:/php/php-cgi.exe" .php
</Files>

</IfModule>



My server is running barely one day now with almost NO traffic at all and my Apache Service did stop completely. I couldn't even restart the Apache Service, I had to kill the httpd.exe service manually before I could get Apache up & running again.

I my error.log I saw the following lines:

[warn] mod_fcgid: process 3940 graceful kill fail, sending SIGKILL
[error] FastCGI process 436 still did not exit, terminating forcefully

Some questions:

1) Is the behaviour due to a bad config of mod_fcgid?

2) Can I conclude that mod_fcgid is far from stable to use?

3) Is the speed gain with mod_fcgid really worth all the hassle? If not, I think I'm gonna stick with mod_php. During the last 5 years, my Apache never crashed. With using mod_fcgid, after a few hours Apache goes down (even with no load at all)

Regards.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Sat 13 Nov '10 23:23    Post subject: Reply with quote

1. Not in my book, there is a history of this problem going back to mod_fcgid 2.2.

2. I think so, many may argue otherwise.

3. Speed gain? I have never seen a speed gain with fcgid, quite the opposite. A 3 second benchmark with mod_php is 9-11 seconds with fcgid, for me. Not much of a gain.

I could live without php myself, but very few others could. And since rumor has it there will be no mod_php for Apache 2.4, fgcid will have to be used. My worry is that many will not be able to use cause of this. It is currently the only way to have php with the current Apache alpha.

Question for you. Have you let mod_fcgid/2.3.5b have any time on your server to see if indeed, it does last?
Back to top
flatcircle



Joined: 27 Jun 2006
Posts: 79

PostPosted: Sat 13 Nov '10 23:50    Post subject: Reply with quote

Unbelievable that since mod_fcgid has been moved to ASF, those bugs aren't addressed at all.

Unofficial code changes for mod_fgid 2.3.5:

http://www.apachehaus.com/index.php?option=com_content&view=article&id=140&Itemid=100

I will try 2.3.5b asap and report if this version is more stable.
I used 2.3.6 because I thought those bugs were gone now ASF will develop mod_fcgid in the future, this is certainly not the case Shocked
Back to top
flatcircle



Joined: 27 Jun 2006
Posts: 79

PostPosted: Mon 15 Nov '10 10:28    Post subject: Reply with quote

Seems like 2.5.3b runs without crashing Apache. (server running 1 day now)

Anyway, I'm switching back to mod_php for the moment till the guys at Apache have done their homework right Wink
Back to top
Sob



Joined: 19 Apr 2008
Posts: 30

PostPosted: Mon 15 Nov '10 13:01    Post subject: Reply with quote

James Blond wrote:
The patch is not included in 2.3.6. The patch nerver made it into the offical code. Appling the patch aginst 2.3.6 doesn't work cause the code has changed too much.
I whish my C was bettter so I could figure it out myself how to fix that.

I'm no expert myself, but... First patch for fcgid_bridge.c is included in 2.3.6. As for the second one, the part with moving apr_pool_cleanup_register() can be applied (in fcgid_pm_win.c). So it leaves only those two removed apr_pool_destroy() calls, originally in kill_all_subprocess() in fcgid_pm_main.c. In 2.3.6 it seems to be moved to separate function reclaim_one_pid(). So my guess is, if you remove apr_pool_destroy(proc->proc_pool); (line 378) from there, it should have the same effect as before.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Mon 15 Nov '10 15:20    Post subject: Reply with quote

Sob thanks for reviewing the code. So I made a patch that applies to 2.3.6 and trunk (revision 1035256)

Code:

Index: modules/fcgid/fcgid_pm_main.c
===================================================================
--- modules/fcgid/fcgid_pm_main.c   (revision 1035256)
+++ modules/fcgid/fcgid_pm_main.c   (working copy)
@@ -375,7 +375,6 @@
         proc->diewhy = FCGID_DIE_SHUTDOWN;
         proc_print_exit_info(proc, exitcode, exitwhy,
                              main_server);
-        apr_pool_destroy(proc->proc_pool);
         proc->proc_pool = NULL;
         return 1;
     }
Index: modules/fcgid/fcgid_pm_win.c
===================================================================
--- modules/fcgid/fcgid_pm_win.c   (revision 1035256)
+++ modules/fcgid/fcgid_pm_win.c   (working copy)
@@ -123,7 +123,9 @@
                      "mod_fcgid: can't create wake up thread");
         exit(1);
     }
-
+   apr_pool_cleanup_register(pconf, main_server,
+                       procmgr_stop_procmgr, apr_pool_cleanup_null);
+                      
     return APR_SUCCESS;
 }
 
@@ -249,8 +251,6 @@
 apr_status_t
 procmgr_child_init(server_rec * main_server, apr_pool_t * pchild)
 {
-    apr_pool_cleanup_register(pchild, main_server,
-                              procmgr_stop_procmgr, apr_pool_cleanup_null);
     return APR_SUCCESS;
 }
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Mon 15 Nov '10 16:28    Post subject: Reply with quote

done mod_fcgid 2.3.6b

x86 or x64 take your pick off the download page at http://www.apachehaus.com

Let me know if it helps.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Mon 15 Nov '10 18:06    Post subject: Reply with quote

Thank you again Sob! I had givin it a try but what I ended up with just crashed on first php request.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Mon 15 Nov '10 21:16    Post subject: Reply with quote

For me it works fine on Win7 and w2k8R2.

For each fcgid process I get a line like FastCGI process 424 still did not exit, terminating forcefully when using -k restart
Back to top
flatcircle



Joined: 27 Jun 2006
Posts: 79

PostPosted: Mon 15 Nov '10 22:17    Post subject: Reply with quote

Thanks a lot for offering this version!

Another question:

With mod_fcgid 2.3.6b a graceful restart is possible without manually killing the Apache service first.

However, when fcgid processes do not 'exit', (like in the error message 'FastCGI process 424 still did not exit...' ) do these fcgid processes terminate automatically or will I still need to restart the Apache service after some time to kill the 'hanging' processes?

Sorry for the noob question but fcgid is a new playground for me Wink

Regards.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Mon 15 Nov '10 23:00    Post subject: Reply with quote

flatcircle wrote:
'FastCGI process 424 still did not exit...' ) do these fcgid processes terminate automatically or will I still need to restart the Apache service after some time to kill the 'hanging' processes?


In this case proc_kill_force(proc, main_server); is called to force termination (SIGKILL).

Code:

mod_fcgid: process 3852 graceful kill fail, sending SIGKILL


If you think you have too many processes if there are no requests.
You might adjust FcgidProcessLifeTime cause the default time is one hour.
Back to top
flatcircle



Joined: 27 Jun 2006
Posts: 79

PostPosted: Thu 18 Nov '10 20:56    Post subject: Reply with quote

Thanks for your excellent support (& compiling Wink) guys!
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Sat 20 Nov '10 23:11    Post subject: Reply with quote

Would be great if anyone open a new bug at https://issues.apache.org/bugzilla/ and attaches the patch.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Sun 21 Nov '10 23:03    Post subject: Reply with quote

Added Bug 50309
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Mon 22 Nov '10 18:43    Post subject: Reply with quote

I got a hint from Gregg,
so I changed the patch that it is only for windows and not all OSes

Code:

Index: modules/fcgid/fcgid_pm_main.c
===================================================================
--- modules/fcgid/fcgid_pm_main.c   (revision 1037552)
+++ modules/fcgid/fcgid_pm_main.c   (working copy)
@@ -375,7 +375,9 @@
         proc->diewhy = FCGID_DIE_SHUTDOWN;
         proc_print_exit_info(proc, exitcode, exitwhy,
                              main_server);
-        apr_pool_destroy(proc->proc_pool);
+#ifndef WIN32
+         apr_pool_destroy(proc->proc_pool);
+#endif
         proc->proc_pool = NULL;
         return 1;
     }
Index: modules/fcgid/fcgid_pm_win.c
===================================================================
--- modules/fcgid/fcgid_pm_win.c   (revision 1037552)
+++ modules/fcgid/fcgid_pm_win.c   (working copy)
@@ -123,7 +123,9 @@
                      "mod_fcgid: can't create wake up thread");
         exit(1);
     }
-
+   apr_pool_cleanup_register(pconf, main_server,
+                       procmgr_stop_procmgr, apr_pool_cleanup_null);
+                      
     return APR_SUCCESS;
 }
 
@@ -249,8 +251,6 @@
 apr_status_t
 procmgr_child_init(server_rec * main_server, apr_pool_t * pchild)
 {
-    apr_pool_cleanup_register(pchild, main_server,
-                              procmgr_stop_procmgr, apr_pool_cleanup_null);
     return APR_SUCCESS;
 }


----
edit
fixed VC6


Last edited by James Blond on Mon 22 Nov '10 21:32; edited 1 time in total
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Mon 22 Nov '10 21:26    Post subject: Reply with quote

style:

push #ifndef to first column. Looks odd but actually I think compilers expect at least the # to be in first column. VC6 is rather sticky about this.

This one is my fault since it was pretty late when I shot that email off to you

WIN32 <- all caps

sorry

Edit:

I'd like to thank you for taking this to bugzilla. I am assuming you were able to reproduce this (since it seems not everyone can)

Cheers & Beers
Back to top
Kanashii



Joined: 17 Jul 2006
Posts: 155
Location: Porando

PostPosted: Wed 24 Nov '10 19:06    Post subject: Reply with quote

Fu.k 9 hours down time

@glsmith
Is your compilation x64 php_fcgi on your website without this buq

##
My wathdog fail need to kill httpd.exe and run again if restart nothing happedn
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Wed 24 Nov '10 20:08    Post subject: Reply with quote

if you mean mod_fcgid ... yes, Mario's 2.3.6b is there and I think my 2.3.5b is still there.
Back to top


Reply to topic   Topic: mod_fcgid 2.2 graceful restart bug back in mod_fcgid 2.3.x View previous topic :: View next topic
Post new topic   Forum Index -> Third-party Modules Page Previous  1, 2, 3  Next