<div dir="ltr">So I have this error as well. I mostly see it when a connection times out. Like you mapserver shows no errors but apache has the script ended before headers error. Do you have fcgi enabled? If I disable fcgi I don't get that error, so It could be related to connection a user has to mapserver. Maybe FcgidMaxRequestsPerProcess, FcgidMinProcessesPerClass, FcgidMaxProcessesPerClass  need to be tweaked?<div><br><div> If you do a google search on this error most of the responses says it is either due to a bad cgi script or bad file/dir permissions which in our case I doubt that is the reason. If you figure it out let me know.</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 22, 2020 at 12:31 PM Rahkonen Jukka (MML) <<a href="mailto:jukka.rahkonen@maanmittauslaitos.fi">jukka.rahkonen@maanmittauslaitos.fi</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="FI">
<div class="gmail-m_7501185425691011096WordSection1">
<p class="MsoNormal"><span>Hi,<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I would suspect data, especially because it seems to be OSM data. Perhaps some invalid polygon again.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">You use &layers=default and I suppose that it means all the layers from your mapfile together. In that case I would try to catch the failing layer by adding layers one by one and in
 groups (first &layers=layer1, then &layers=layer2, then &layers=layer1,layer2). 
<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Hopefully that way you can find the failing layer, and then because you know the BBOX you may find the nasty geometry from the database. Without your data and mapfile it is rather useless
 to make very much guesswork, but a small change in bbox may select/not select a bad geometry, of change of bbox may change scale so much that source data come from a different table if you have a scale dependent layer group in the mapfile etc.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">If the issue is due to bad geometry and you use PostGIS you may find it with ST_IsValid and ST_IsValidReason, and correct with ST_MakeValid.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">-Jukka Rahkonen-<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><b>Lähettäjä:</b> mapserver-users <<a href="mailto:mapserver-users-bounces@lists.osgeo.org" target="_blank">mapserver-users-bounces@lists.osgeo.org</a>>
<b>Puolesta </b>Johannes Paul<br>
<b>Lähetetty:</b> keskiviikko 22. tammikuuta 2020 13.02<br>
<b>Vastaanottaja:</b> <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<b>Aihe:</b> [mapserver-users] cgi-error: End of script output before headers mapserv<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">Hello,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">my mapserver is having a very strange behaviour, which I can't explain, nor debug.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I'm using mapserver 7.0.0 along with apache http server 2.4.6.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Most of the time, the server is working just fine, i.e. when I request a typical URL, I get my image back:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><a href="http://10.0.0.22/cgi-bin/mapserv?map=/var/www/html/osm-transp-en-default.map&VERSION=1.1.0&REQUEST=getmap&SERVICE=wms&STYLES=&BBOX=-9.143,38.746,-9.140,38.748&HEIGHT=256&WIDTH=256&LAYERS=default&FORMAT=image/png&SRS=EPSG:4326&TRANSPARENT=true" target="_blank">http://10.0.0.22/cgi-bin/mapserv?map=/var/www/html/osm-transp-en-default.map&VERSION=1.1.0&REQUEST=getmap&SERVICE=wms&STYLES=&BBOX=-9.143,38.746,-9.140,38.748&HEIGHT=256&WIDTH=256&LAYERS=default&FORMAT=image/png&SRS=EPSG:4326&TRANSPARENT=true</a><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">but then, when I slightly change bbox values, I get an internal server error (500):<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><a href="http://10.0.0.22/cgi-bin/mapserv?map=/var/www/html/osm-transp-en-default.map&VERSION=1.1.0&REQUEST=getmap&SERVICE=wms&STYLES=&BBOX=-9.1433,38.7460,-9.1406,38.7487&HEIGHT=256&WIDTH=256&LAYERS=default&FORMAT=image/png&SRS=EPSG:4326&TRANSPARENT=true" target="_blank">http://10.0.0.22/cgi-bin/mapserv?map=/var/www/html/osm-transp-en-default.map&VERSION=1.1.0&REQUEST=getmap&SERVICE=wms&STYLES=&BBOX=-9.1433,38.7460,-9.1406,38.7487&HEIGHT=256&WIDTH=256&LAYERS=default&FORMAT=image/png&SRS=EPSG:4326&TRANSPARENT=true</a><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I don't get any mapserver error log, but I do get an apache error log saying:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">[cgi:error] End of script output before headers: mapserv<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">This is really an strange behaviour which I can't explain.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Did anyone already experienced a similar situation ?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Jo<u></u><u></u></p>
</div>
</div>
</div>
</div>

_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a></blockquote></div>