Discussion:
KML output problems/crashes/bad reprojection
yeryry
2014-10-07 20:40:42 UTC
Permalink
I've been trying to get KML output working (6.5, OSgeo4W). After a lot of
experimentation and all kinds of strange results, I managed to get
something somewhat working, but still have some problems... The IRC channel
seems dead, so here I am again.
I've adapted the Itasca example map file to try to make it simpler... My
example query strings are at the bottom.
https://gist.github.com/anonymous/f0516f2766699e1ce3db

With the driver set to "OGR/KML" (this is undocumented?):
WFS (queries 1 and 2) works.
WMS (query 3) causes mapserv.exe to crash.

With the driver set to "KML":
WFS (queries 1 and 2) produces output with no points. There must be some
projection problem. "Projection library error. All points failed to
reproject". If I use the other EXTENT line, it crashes.
WMS (query 3) now works. Or seems to...

There may be a problem with my settings, but I don't think it should ever
crash because of that. I've had lots of problems before I tried to use KML
output, but they didn't include crashing. Because making various apparently
unrelated changes results in it crashing, with no output to the log at all,
perhaps there's a problem with some error message routine? This may be a
problem with the OSgeo4W build, but they seem to have no user support at
all...
And should the output options affect the projection at all?

Another problem... With WMS, the width and height parameters in the query
have a big effect on the coordinates in the output (same as this?
https://trac.osgeo.org/mapserver/ticket/3928). This doesn't make sense to
me, as KML doesn't have "pixels", so the width and height of a hypothetical
"image" should have no effect on coordinates, and maybe no effect on output
at all. Also "non-square pixels" (
https://trac.osgeo.org/mapserver/ticket/3949) makes no sense for vector
output. After discovering this problem with WMS, I switched to trying WFS,
but then had the other problems.
yeryry
2014-10-08 17:00:51 UTC
Permalink
I think I've discovered two causes of crashes...

First, one with the KML driver...

msDrawQueryLayer creates and draws a temporary layer here:
https://github.com/mapserver/mapserver/blob/3e8aa5a4d92c9bad105306ebe5117ed29d2b0e7c/mapdraw.c#L1205
The KML renderer sets a reference to the temporary layer here:
https://github.com/mapserver/mapserver/blob/3e8aa5a4d92c9bad105306ebe5117ed29d2b0e7c/mapkmlrenderer.cpp#L371
msDrawQueryLayer later calls msDrawShape here:
https://github.com/mapserver/mapserver/blob/3e8aa5a4d92c9bad105306ebe5117ed29d2b0e7c/mapdraw.c#L1295
which eventually results in a call to KmlRenderer::renderGlyphs
https://github.com/mapserver/mapserver/blob/3e8aa5a4d92c9bad105306ebe5117ed29d2b0e7c/mapkmlrenderer.cpp#L693
which gets to KmlRenderer::createPlacemarkNode and reuses that reference
that was set:
https://github.com/mapserver/mapserver/blob/3e8aa5a4d92c9bad105306ebe5117ed29d2b0e7c/mapkmlrenderer.cpp#L585
even though that temporary layer was freed earlier, leading to the crash.

And one with WMS:

It crashes around here:
https://github.com/mapserver/mapserver/blob/3e8aa5a4d92c9bad105306ebe5117ed29d2b0e7c/mapdraw.c#L106
Probably due to trying to setting NULL->map... That error message should
probably be moved before that line.

Loading...