<div dir="ltr"><div><div>Hi all<br><br></div>We are trying to use QGIS Server with nginx / supervisor instead of classical Apache / mod_fcgid.<br><br></div><div>We have seen that for each server request, such as a GetMap responding an image rendered from a single Shapefile (or Tiff, of whatever), QGIS Server opens a new access to the file.<br><br></div><div>Exemple number found via the lsof command, after some requests<br><br>lsof /tmp/someShapefile.shp | wc -l<br>126<br></div><div><br></div><div>which means here 126 requests has been processed by QGIS Server, but the access to Shapfile has never been released. Each requests leads to a new file handler.<br><br></div><div>Imagine a project with several layers, and a web map with many users / requests --> this lead rapidly to many opening of the same files open for nothing, and can cause issues.<br><br></div><div>In Apache configuration, this was not sensible, as mod_fcgid and Apache kill QGIS Server worker after N completed requests, and it seems the ulimit used is the system limit.<br><br></div><div>In our configuration, supervisor has by default a ulimit of 1024 files opened. This limit is vers fast reached ( 1024 requests only ). We could tune this configuration, but it seems to walk aournd the issue without solving its origin.<br><br><br></div><div>We have 2 ways of dealing with it :<br><br></div><div>* Make sure QGIS Server does not open a data file each time a request needs it --> we will investigate if the cache is well used<br><br></div><div>* We could also use GDALOpenShared instead of GDALOpen , and OGROpenShared instead of OGROpen in QGIS provider code:<br><br>GDALOpenShared : <a href="http://www.gdal.org/gdal_8h.html#a46a02c21047d78f88f8abb1ff6b14ae2">http://www.gdal.org/gdal_8h.html#a46a02c21047d78f88f8abb1ff6b14ae2</a><br></div><div>OGROpen in QGIS : <a href="https://github.com/qgis/QGIS/search?utf8=%E2%9C%93&q=ogropen&type=Code">https://github.com/qgis/QGIS/search?utf8=%E2%9C%93&q=ogropen&type=Code</a><br></div><div><br><br></div><div>Any idea, comment appreciated !<br><br></div><div>Regards,<br></div><div>MichaĆ«l<br></div><div><br></div></div>