FCGI app reloading on every request

John Nagle nagle at animats.com
Tue Sep 4 01:15:45 EDT 2007


Martin v. Löwis wrote:
> John Nagle schrieb:
> 
>>   I'm converting a web app from CGI to FCGI.  The application works fine
>>under FCGI, but it's being reloaded for every request, which makes FCGI
>>kind of pointless.  I wrote a little FCGI app which prints when the
>>program is loaded and when it gets a request.  And indeed, the program
>>gets reloaded for
>>each HTTP request.  Something is probably misconfigured.  But what?
> 
> 
> The most likely reason is that your FastCGI server voluntarily choses
> to exit after one request. Can you share the mainloop of your
> application?
> 
> Regards,
> Martin

     It turns out that's not the problem.

     What's actually happening is that FCGI isn't running at all.
My .fcgi file is being executed by Apache's CGI handler, and
"fcgi.py" recognizes this, then reads the parameters as if
a CGI program.  So it works just like a CGI program: one
load per request.  Not sure why Apache is doing that yet.
I'm looking at Apache configuration files now.

     The main loop is in "fcgi.py", which calls the
user application as a function.  The user app doesn't have the
option of exiting after one request, short of aborting without
returning a result.

                     John Nagle



More information about the Python-list mailing list