<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-ligatures:standardcontextual;
mso-fareast-language:EN-US;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:2.0cm 42.5pt 2.0cm 3.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="RU" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Good day to all!<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">Testing mapserver under nginx and Linux.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Mapserver launched as a process via fcgiwrap terminates after the first response and does not stay in memory as in Apache</span><span lang="EN-US">
</span><span lang="EN-US">mod_fcgid.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">After some research I found out that the reason is in the FCGI_Accept function which should wait for a connection but it returns -1 when it is run the second time.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> while( !finish_process && FCGI_Accept() >= 0 ) { <-- first time FCGI_Accept() return 0. Next run always -1<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">--------<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> int a=-2;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> while( !finish_process && FCGI_Accept() >= 0 ) { <-- first time FCGI_Accept() return 0.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> a = FCGI_Accept();<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> msDebug("==FCGI_Accept on start== %d\n", a); <-- first time FCGI_Accept() return -1.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I understand that this is most likely not a mapserver problem. Most likely the problem is on the fcgiwrap service side. But maybe someone has experience running a mapserver under nginx in FastCGI mode?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">MapServer version 8.0.1 PROJ version 8.2 GDAL version 3.9 OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WFS_SERVER SUPPORTS=WCS_SERVER
SUPPORTS=OGCAPI_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE INPUT=FLATGEOBUF<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">CentOS Stream release 9 <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">nginx version: nginx/1.20.1<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">fcgiwrap version 1.1.0<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>