gnosek / fcgiwrap

Simple FastCGI wrapper for CGI scripts
http://nginx.localdomain.pl/
MIT License
407 stars 134 forks source link

Child FCGI process keeps respawning after each request #58

Open Dweller opened 2 years ago

Dweller commented 2 years ago

I've a nginx server which is passing requests via /var/run/fcgiwrap.socket

location /bin {
    root /var/www/;
    fastcgi_pass unix:/var/run/fcgiwrap.socket;
    include fastcgi_params;
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
 }
My C program is calling FCGI_accept() in a while loop.
 while (FCGI_Accept() >= 0) {
    blah
   }

When I hit the nginx server with my request it works once then FCGI-Accept ruturns -1 and that means the process is respawning every time I make a request.

Is there a way to have tohave fcgiwrap honour the Accept for the next call?

nikolaysu commented 2 months ago

Join the question.

nikolaysu commented 2 months ago

up while( !finish_process && FCGI_Accept() >= 0 ) { <-- first time FCGI_Accept() return 0. a = FCGI_Accept(); msDebug("==FCGI_Accept on start== %d\n", a); <-- first time FCGI_Accept() return -1.

maybe you need to clear the request somehow?