[MapServer-users] A PROJ_DATA related issue with MS 8.6

Seth G sethg at geographika.co.uk
Fri Apr 10 14:47:37 PDT 2026


Hi Jukka,

I've not encountered this before, but this could be due to your production server having a lot of traffic (which any test server would not). Switching to using PROJ_DATA in your Mapfiles would likely fix it, as the value would be read on every request. 

A few theories on a possible clause below.

1. The FastCGI worker crashes, and msCleanUp() is called. This calls msSetPROJ_DATA(NULL, NULL) and   msProjectionContextPoolCleanup(), and the worker handles some other requests before being recycled. 

2. There is some race condition, where msLoadConfig is using putenv and PROJ is calling getenv before the value is set. The value (NULL) is then cached.

https://github.com/OSGeo/PROJ/blob/79e50ef64fd72563e563452900e3e838932a6dec/src/filemanager.cpp#L1113

There is a note in https://github.com/toshic/libfcgi/blob/master/libfcgi/fcgi_stdio.c

> In particular do not use setenv(3) or putenv(3) in conjunction with FCGI_Accept.

Maybe setting up the PROJ context outside the FCGI_Accept() would help here. 

3. msProjDataInitFromEnv() (which calls msSetPROJ_DATA) is called in msSetUp() and in msLoadConfig() (via msConfigSetConfigOption). 
4. Something about the PROJ connection pools and msProjectionContextGetFromPool..

All the above have the same root issue - getenv returns a NULL for PROJ_DATA, either because putenv hasn't yet been called, or it has been set to NULL. 
Maybe adding logging in some of the above functions would help to find the cause. 

Seth

--
web:https://geographika.net & https://mapserverstudio.net
mastodon: @geographika at mastodon.social

On Fri, Apr 10, 2026, at 3:39 PM, Rahkonen Jukka via MapServer-users wrote:
> Hi,
>
> We tried to upgrade into MapServer 8.6 but we had to revert because the 
> GetMap requests begun to fail occasionally.  Unfortunately the issue 
> appeared only in the production environment. Now we are a bit lost 
> because in the test environment we do not get errors, and the 
> environment that shows the errors cannot possibly be used for testing.
>
> The error appears so that after lots of succesful request lots of 
> subsequent request fail because MapServer can't find PROJ_DATA any more.
> When we switched into MS 8.6 we also changed the PROJ_DATA 
> configuration into the config file, as ENV block.  Before that 
> PROJ_DATA was set in each mapfile separately.
>
> Summary about our situation
>
> - Production server is a physical RHEL server with 64 cores
> - Test server is a virtual RHEL server
> - Both servers were running MapServer 8.6 on same versions of Apache 
> HTTPD mod_fcgid
> - Every now and then PROJ_DATA got lost on the production server, but 
> never on the test server
> - PROJ_DATA for MapServer 8.6 was configured in a CONFIG file
> - layers are mostly raster layers, so GDAL is also involved
>
> We plan to test if moving PROJ_DATA configuration back into mapfiles 
> could resolve the issue, but unfortunately the next possibility to make 
> the test is weeks ahead. Meanwhile we would like to know if other users 
> have faced similar issues. Also, if someone has any idea about what 
> goes wrong it could help us to start testing the right things. Judging 
> be the behavior it feels like sometimes a new fast-cgi process does not 
> get the information about the location of the PROJ_DATA directory. But 
> why this would happen only on the procuction server (physical) but not 
> on the test server (virtual) is a mystery.
>
> -Jukka Rahkonen-
> _______________________________________________
> MapServer-users mailing list
> MapServer-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the MapServer-users mailing list