[GIS] Debugging MapCache / MapServer error

cachemapserverwms

I'm trying to resolve an error when accessing a MapServer layer via MapCache.

I'll add excerpt of the relevant files below, but the basic situation is:

When accessing a particular WMS layer via MapCache, there is one small area of the map with missing tiles. The rest of the layer works fine.

Apache log shows the following:

[Tue Jan 14 13:23:22 2014] [error] [client ::1] Premature end of script headers: mapserv

[Tue Jan 14 13:23:22 2014] [error] [client 192.168.56.1] wms request for tileset Aerial returned an unsupported format:\n<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n<html><head>\n<title>500 Internal Server Error</title>\n</head><body>\n<h1>Internal Server Error</h1>\n<p>The server encountered an internal error or\nmisconfiguration and was unable to complete\nyour request.</p>\n<p>Please contact the server administrator,\n [no address given] and inform them of the time the error occurred,\nand anything you might have done that may have\ncaused the error.</p>\n<p>More information about this error may be available\nin the server error log.</p>\n<hr>\n<address>Apache Server at localhost Port 80</address>\n</body></html>\n

When building the cache for this layer, no errors are reported.

Even stranger, accessing the WMS layer directly through MapServer works perfectly.

The above error is the only meaningful error I've been able to find.

To debug this I've set DEBUG 5 on both MAP and LAYER properties and tried accessing the 'broken' tile both via MapCache and MapServer. The results are… weird.

I'll post the files below, but note that:

  • The log for the MapCache request ends prematurely: msDrawRasterLayerGDAL(): red,gree
  • The source and other attributes referenced in the log are vastly different between the MapServer and MapCache request. Everything about the request is the same (projection, bounding box, etc), except the 'bad' request is passed through MapCache.

Files / URLs

MapCache request (broken)

  • URL: http://MYHOST/maps?LAYERS=Aerial&BGCOLOR=0x444444&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image%2Fjpeg&SRS=EPSG%3A27700&BBOX=363840,145762,365600,147522&WIDTH=512&HEIGHT=512
  • Log: apache.mapcache.log

MapServer request (works)

  • URL: http://HOST/cgi-bin/mapserv?MAP=/path/to/Aerial.map&LAYERS=Aerial&BGCOLOR=0x444444&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image%2Fjpeg&SRS=EPSG%3A27700&BBOX=363840,145762,365600,147522&WIDTH=512&HEIGHT=512
  • Log: apache.mapserver.log

MapCache config excerpt(Paths / URIs altered)

mapcache.xml

Map file

Aerial.map

Best Answer

This is clearly a mapserver issue, although you are only seeing it triggered through extent /sizes passed by mapcache (mapcache will alter the passed in extent/sizes to account for metatiling). If you replay the failing mapcache request, your logs will also show a request from mapcache to mapserver requesting the data to be tiled. That second url should be the one you can start debugging with (as it will also fail if you load it directly in your browser).

Related Question