[FASTCGI] FASTCGI 500 error occurring problem.

Ora Mom bigbanage at naver.com
Wed Oct 29 03:05:44 EDT 2008


Hello.
 
I'm using mod_fastcgi and the cgi program coded with C language.
Apache version = 1.3.27.
 
some times, the 500 error occurred and logged message like "FastCGI: incomplete headers (0 bytes) received from server" 
on the apache error log. 
first, my app's sudo code is like below.
//test.c
....
int isProcessing = RUN_PROCESSING
static void quit( int signo )
{
 isProcessing = STOP_PROCESSING;
 freeResources();
 exit(0);
}
int main ()
{
 /* for signal handling */
 signal( SIGPIPE, SIG_IGN );
 signal( SIGQUIT, quit );
 signal( SIGUSR1, quit );
 signal( SIGTERM, quit );
 
 while(FCGI_Accept() >= 0) {
 if(isProcessing == STOP_PROCESSING) break;
 accessDbAndProcsessing();
 show_result();
 
 FCGI_Finish();
 freeResources();
 }
 
 freeResouces();
 return 0;
}
 
This application some times take some long times about 7-8sec above.
 
The mod_fastcgi initiallization command is like below.
FastCgiIpcDir /usr/local/apache/tmp/fcgi
FastCgiConfig -initial -restart -maxClassProcesses 20 -maxProcesses 180 -startDelay 5 -killInterval 600
 
I found that the error occurred whenever the fastcgi process manager do the dynamic process kill policy. (in my setting, every 10min).
And I also found that, the processManager send SIGTERM to the fastcgi APP with each dynamic process killing.
And then my app receive the SIGTERM and on the signal handler, quit(), it shutdown current process immediately.
 
so I modified the quit() to just setting the valuable isProcessing to STOP_PROCESSING and in the loop, if the valuable is STOP_PROCESSING then
break the loop and close. because if current my app is processing something then for exit after complete current processing.
 
static void quit( int signo )
{
 isProcessing = STOP_PROCESSING;
 //freeResources();
 //exit(0);
}
 
but the modification didn't work. 
the processManager still send SIGTERM when killing unneeded dynamic process and do in the code quit()
but can not exit the loop. so the process can not be closed.
 
Please give me some advice about this.
 
And I want to know why the FastCGI Process Manager send SIGTERM to kill the process while the process is running.
Can the PM send the SIGTERM when the fcgi program waiting request only not processing?
Thank you very much.
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.pins.net/mailman/private.cgi/fastcgi-developers/attachments/20081029/ef263826/attachment.html>


More information about the FastCGI-developers mailing list