Ticket #3598 (closed defect: fixed)
Calling mapserv with no query string causes mapserver fastcgi process to exit
| Reported by: | ajiintser | Owned by: | sdlime |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | MapServer FastCGI | Version: | 6.0 |
| Severity: | normal | Keywords: | |
| Cc: | warmerdam, homme |
Description
Error
We are using lighthttpd, fastcgi and Mapserver 5.2.0. We were seeing a lot of the following errors in our logs:
2010-11-04 04:53:50: (mod_fastcgi.c.2462) unexpected end-of-file (perhaps the fastcgi process died): pid: 925 socket: unix:/var/tmp/lighttpd/mapserver-fastcgi.socket-3
This is causing a lot of valid requests being returned http 500 errors.
Cause
We traced this back to a load balancer pinging Mapserver with the url /cgi-bin/mapserv with no query string. This causes the mapserv process to exit and the NEXT request will sometimes get the error above. We can see by hitting /cgi-bin/mapserv the process will die.
By looking at the lighttpd page /server-counters we see: fastcgi.backend.0.4.died: 3 This gets incremented for every time you hit /cgi-bin/mapserv with no query string.
Code causing the issue
mapserv.c Line 1201:
mapserv->request->NumParams? = loadParams(mapserv->request);
This is inside the "while( FCGI_Accept() >= 0 ) {" loop. Inside this loop we should not call exit but call continue so the process does not exit but stays alive to process the next request. However cgiutils.loadParams does call exit.
cgiutil.c Line 179:
if(strlen(s)==0) {
msIO_printf("Content-type: text/html%c%c",10,10); msIO_printf("No query information to decode. QUERY_STRING is set, but empty.\n"); exit(1);
}
This method exits even if Mapserver is running in fastcgi mode.
Ramifications
1) Using /cgi-bin/mapserv to determine if mapserver is up will cause intermittent http 500 errors. 2) Can be used to deny service by making the fastcgi mapserv processes stop. These process will fire up again, but a lot of requests will get http 500 errors as the backend processes have stopped.
