<div dir="ltr"><div><div><div><div><div>Hi<br><br></div>I tested a quick and dirty patch, by replacing all occurences of OGROpen byt OGROpenShared in QGIS source, then rebuild and test server side --> No locks anymore ! QGIS Server works like a charm here, without increasing the number of opening for the same file.<br><br></div>The only (but big) problem, is that this seems to be not thread safe, so it makes QGIS Desktop segfault. For example, I just started QGIS 2.8.3 with my patch, and it segfaults when "Browser" pannel read the content of my favorite folders (and find Shapefiles). I am pretty sure that the multithreaded rendering would also cause it to segfault.<br></div><div><br>No worries for the Server side, since it is not multithreaded by conception.<br></div><div><br></div>We are investigating this issue and will report back here.<br><br></div>Cheers<br></div>Michaël<br><div><div><div><br><br><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-09-11 9:39 GMT+02:00 kimaidou <span dir="ltr"><<a href="mailto:kimaidou@gmail.com" target="_blank">kimaidou@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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" target="_blank">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" target="_blank">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>
</blockquote></div><br></div>