apache mod_fcgid problems

4.4k views Asked by At

I have a problem on multiple servers than use Apache module mod_fcgid to serve a cgi script that processes the request (ticket validation and similar processing) then serves files on the server based on the result of the processing.

I keep getting the following errors repeatedly in the logs:

[Mon Jan 30 23:11:41 2012] [warn] [client 95.35.160.193] mod_fcgid: error reading data, FastCGI server closed connection

[Mon Jan 30 23:11:41 2012] [warn] [client 95.35.160.193] (32)Broken pipe: mod_fcgid: ap_pass_brigade failed in handle_request_ipc function

[Mon Jan 30 23:13:34 2012] [warn] [client 37.8.52.128] mod_fcgid: can't apply process slot for /var/www/cgi-bin/assetx.fcgi

These problems cause the server to be slow and other times result in service temporarily unavailable error.

The servers have large traffic on them, I have currently configured the following fcgi directives as below:

FcgidMaxRequestsPerProcess       0
FcgidMaxProcesses       300
FcgidMinProcessesPerClass 0
FcgidIdleTimeout        240
FcgidIOTimeout  240
FcgidBusyTimeout 300

the average load on the servers is normal, the number of processes is on average 250 processes.

I have done research for days about this issue, some say it is a permission problem, I've followed their suggestion, didn't help. I tried to tune the parameters above, these are the final values I tried, but they didn't work as well. I am also trying out nginx to be used instead of apache but I cannot find a suitable way to run the cgi script with this high load on the server using nginx.

What can I do to fix this problem?

1

There are 1 answers

0
Tim De Lange On

Your app is dying before Apache can contact it successfully. The answer is to find out why the app is dying.

FastCGI process should never die or quit, even in an error condition. Apache expects FastCGI script to just keep on being there.

You mention you have a cgi script. How did you modify it to support FastCGI?

Usually you need to switch to something like CGI::Fast, remove all calls to die and exit, and refactor your script to run using the CGI::Fast while loop.