[mapserver-dev] potential fcgi hang problem

Frank Warmerdam warmerdam at pobox.com
Wed Jul 23 11:02:25 EDT 2008


bartvde at osgis.nl wrote:
> Hi list,
> 
> we are running Mapserver as a FCGI, and if someone tries an illegal mode
> or something similar, it will cause all the MS threads to hang. We are
> guessing this is because of the exit(0)'s in Mapserver's error handler.
> 
> Is it possible for someone who is more knowledgeable to look into this? TIA.
> 
> So e.g. trying a &mode=ma&layers=all request for about 10 times will cause
> everything to freeze up.
> 
> What we get is:
> 
> [Wed Jul 23 09:53:28 2008] [warn] FastCGI: (dynamic) server
> "/var/www/fcgi-bin/mapserv.fcgi" has failed to remain running for 30
> seconds given 3 attempts, its restart interval has been backed off to 600
> seconds
> 
> [Wed Jul 23 10:04:11 2008] [warn] FastCGI: (dynamic) server
> "/var/www/fcgi-bin/mapserv.fcgi" (pid 32486) terminated by calling exit
> with status '0'
> [Wed Jul 23 10:04:11 2008] [warn] FastCGI: (dynamic) server
> "/var/www/fcgi-bin/mapserv.fcgi" has remained running for more than 30
> seconds, its restart interval has been restored to 1 seconds

Bart,

Interesting.  My general thinking has been that the mapserv fastcgi
could just exit if something goes wrong so we don't have to worry about
things being in a bad state before processing another request.  That the
system would just start a new fastcgi instance in it's place and that the
only loss is that connections and stuff would need to be reopened.

But I can see how errors could trigger this "back off restart" behavior
by the apache mod_fcgi.

I can think of two obvious approaches to deal with this.

1) Look into mod_fcgi settings and see if the restart-backoff stuff can be
reduced or removed.

2) We could start trying to continue processing a new request after an
error in mapserv.  The main issue is that this will require touching
many threads of control - for instance in the main mapserv.c logic.
Everywhere (or at least at points of interest) where writeError() is
called we would need to modify it to avoid an exit() and to be ready to
process a new request after writing the error.

My suggestion would be to first look at the apache side of things and
see what can be done.  If that isn't helpful, we could do some error
recovery stuff but it seems like the work could be endless, and it will
add mess and complication to a mapserv.c mainline that is already
horrendous.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the mapserver-dev mailing list