Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

End of script output before headers: mapserv_wrapper #179

Open
DavidPavlicek opened this issue Jun 4, 2021 · 4 comments
Open

End of script output before headers: mapserv_wrapper #179

DavidPavlicek opened this issue Jun 4, 2021 · 4 comments

Comments

@DavidPavlicek
Copy link

Some outputs from mapserver_wrapper result in Apache 500 HTTP response. For example, querying browse mode without a defined template produce this log message and HTTP 500 response:

[warn] [pid 25] mod_fcgid: stderr: mapserv(): Web application error. Traditional BROWSE mode requires a TEMPLATE in the WEB section, but none was provided. `
[error] [pid 25] End of script output before headers: mapserv_wrapper
[04/Jun/2021:09:17:22 +0000] "GET /?map=/etc/mapserver/honitby/honitby.map HTTP/1.1" 500 806 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36"

But when I try exec into container and execute mapserv_wrapper (or mapserv) directly, like this:

/usr/local/bin/mapserv_wrapper "QUERY_STRING=map=/etc/mapserver/honitby/honitby.map"

it produces correct HTML response:

Content-Type: text/html

<HTML>
<HEAD><TITLE>MapServer Message</TITLE></HEAD>
<!-- MapServer version 7.4.5 OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS SUPPORTS=RSVG SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=GEOS SUPPORTS=POINT_Z_M SUPPORTS=PBF INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE -->
<BODY BGCOLOR="#FFFFFF">
mapserv(): Web application error. Traditional BROWSE mode requires a TEMPLATE in the WEB section, but none was provided.
</BODY></HTML>

It works a bit strange by my observations. For example, when I attach to container log (docker logs -f) it starts to produce correct HTML responses instead of 500

I also try to redirect error output to stdout or file, instead of stderr, but with no luck.

Probably the 'end of script output before headers: mapserv_wapper' is the key, but I dong know what can be wrong...

@sbrunner
Copy link
Member

sbrunner commented Jun 4, 2021

It's looks strange, normally the message End of script output before headers: mapserv_wrapper means that MapServer crash...
But the docker logs -f shouldn't change anything...

@DavidPavlicek
Copy link
Author

DavidPavlicek commented Jun 4, 2021

I just try to digg deepr and this is result from MS_DEBUGLEVEL=5 at first call:

 [warn] [pid 26] mod_fcgid: stderr: loadParams() QUERY_STRING: map=/etc/mapserver/honitby/honitby.map
 [warn] [pid 26] mod_fcgid: stderr: msLoadMap(): 0.003s
 [warn] [pid 26] mod_fcgid: stderr: CGI Request 1 on process 81
 [warn] [pid 26] mod_fcgid: stderr: mapserv(): Web application error. Traditional BROWSE mode requires a TEMPLATE in the WEB section, but none was provided.
 [warn] [pid 26] mod_fcgid: stderr: mapserv request processing time (msLoadMap not incl.): 0.000s
 [warn] [pid 26] mod_fcgid: stderr: msFreeMap(): freeing map at 0x1f22560.
 [warn] [pid 26] mod_fcgid: stderr: freeLayer(): freeing layer at 0x1f29220.
 [warn] [pid 26] mod_fcgid: stderr: msPostGISLayerIsOpen called.
116866 - 172.17.0.1 - - [04/Jun/2021:10:14:02 +0000] "GET /?map=/etc/mapserver/honitby/honitby.map HTTP/1.1" 200 643 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36"

this is a log from subsequent calls:

 [warn] [pid 25] mod_fcgid: stderr: loadParams() QUERY_STRING: map=/etc/mapserver/honitby/honitby.map
 [warn] [pid 25] mod_fcgid: stderr: msLoadMap(): 0.001s
 [warn] [pid 25] mod_fcgid: stderr: CGI Request 2 on process 81
 [warn] [pid 25] mod_fcgid: stderr: mapserv(): Web application error. Traditional BROWSE mode requires a TEMPLATE in the WEB section, but none was provided.
 [warn] [pid 25] mod_fcgid: stderr: mapserv request processing time (msLoadMap not incl.): 0.000s
 [warn] [pid 25] mod_fcgid: stderr: msFreeMap(): freeing map at 0x1f22560.
 [warn] [pid 25] mod_fcgid: stderr: freeLayer(): freeing layer at 0x1f29e60.
 [warn] [pid 25] mod_fcgid: stderr: msPostGISLayerIsOpen called.
 [error] [pid 25] End of script output before headers: mapserv_wrapper
2651 - 172.17.0.1 - - [04/Jun/2021:10:14:12 +0000] "GET /?map=/etc/mapserver/honitby/honitby.map HTTP/1.1" 500 806 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36"

Probably something with PostGIS layers, maybe Postgres connection pooling related (different outputs based on calls order)... Attaching to docker logs probably won't have any effect here, probably just a coincidence with my tests...

--- EDIT ---
Just tried on a project without PostGIS and it behaves the same... first load OK, subsequent loads 500... Maybe this issue is more appropriate for the MS mailing list...

@sbrunner
Copy link
Member

sbrunner commented Jun 4, 2021

Maybe this issue is more appropriate for the MS mailing list...

Probably yes :-)

@DavidPavlicek
Copy link
Author

DavidPavlicek commented Jun 10, 2021

Unfortunately, i didn't receive any suggestions at MS mailing list about this issues. But I think it has to be related to hoe Apache interact with mapserver. When I exec mapserv directly or through wrapper inside container, everything works as expected. Issues appear only when I request something through Apache... Strange...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants