[mapserver-dev] Found a bug

Stephen Woodbridge woodbri at swoodbridge.com
Sat Mar 16 08:12:40 PDT 2013


Hi Devs,

Found a bug. I'll write it up later.

/usr/local/bin/shp2img -m ./images.map -o edges1.png -i agg_qn
msSmallMalloc(): Out of memory allocating -134849247 bytes.

shp2img -v
MapServer version 6.2.0 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ 
SUPPORTS=GD SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO 
SUPPORTS=SVG_SYMBOLS SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER 
SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=GEOS INPUT=JPEG 
INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE


Breakpoint 1, msSmallMalloc (nSize=4160118049) at maputil.c:2191
2191      if( nSize == 0 )
(gdb) bt
#0  msSmallMalloc (nSize=4160118049) at maputil.c:2191
#1  0xb7ed5fcd in msPostGISBuildSQLSRID (layer=0x805aac8) at 
mappostgis.c:1756
#2  0xb7ed6566 in msPostGISBuildSQLWhere (layer=0x805aac8, rect=0xbffff334,
     uid=0x0) at mappostgis.c:1921
#3  0xb7ed69fb in msPostGISBuildSQL (layer=0x805aac8, rect=0xbffff334, 
uid=0x0)
     at mappostgis.c:2038
#4  0xb7ed77bd in msPostGISLayerWhichShapes (layer=0x805aac8, rect=...,
     isQuery=0) at mappostgis.c:2508
#5  0xb7ed97c9 in msLayerWhichShapes (layer=0x805aac8, rect=..., isQuery=0)
     at maplayer.c:140
#6  0xb7eff5e3 in msDrawVectorLayer (map=0x8051ab8, layer=0x805aac8,
     image=0x8061e38) at mapdraw.c:959
#7  0xb7efee2e in msDrawLayer (map=0x8051ab8, layer=0x805aac8, 
image=0x8061e38)
     at mapdraw.c:808
#8  0xb7efddad in msDrawMap (map=0x8051ab8, querymap=0) at mapdraw.c:437
#9  0x08049cf8 in main (argc=7, argv=0xbffff7e4) at shp2img.c:293
(gdb) up
#1  0xb7ed5fcd in msPostGISBuildSQLSRID (layer=0x805aac8) at 
mappostgis.c:1756
1756              f_table_name = (char*)msSmallMalloc(pos_paren - pos + 1);
(gdb) p pos_paren
$1 = 0x0
(gdb) p pos
$2 = 0x809a2e0 "edges1 where dir != 'B' as foo"
(gdb)

Looks like the problem is a missing paren in the One_Way_Arrows layer SQL.

the Mapfile is:

MAP
   NAME "pgRouting Test Mapfile"
   EXTENT 0 0 4 4
   SIZE 500 500
   IMAGECOLOR 238 238 153
   TRANSPARENT OFF
#  UNITS PIXELS
   FONTSET "fonts.txt"

   OUTPUTFORMAT
     NAME agg_qn
     DRIVER "AGG/PNG"
     EXTENSION "png"
     MIMETYPE "image/png"
     IMAGEMODE RGB
     FORMATOPTION "INTERLACE=false"
     FORMATOPTION "QUANTIZE_NEW=ON"
     FORMATOPTION "QUANTIZE_DITHER=OFF"
     FORMATOPTION "QUANTIZE_COLORS=256"
   END

   SYMBOL
     NAME "circle"
     TYPE ELLIPSE
     POINTS 1 1 END
   END

   SYMBOL
     NAME "circle-filled"
     TYPE ELLIPSE
     FILLED TRUE
     POINTS 1 1 END
   END

   SYMBOL
     NAME "one_way_from"
     TYPE TRUETYPE
     FONT "arial-bold"
     CHARACTER ">"
     #GAP -40
   END

   SYMBOL
     NAME "one_way_to"
     TYPE TRUETYPE
     FONT "arial-bold"
     CHARACTER "<"
     #GAP -40
   END

   LAYER
     NAME "Streets"
     STATUS DEFAULT
     TYPE LINE
     CONNECTIONTYPE postgis
     CONNECTION "user=postgres dbname=trsp_test host=localhost port=5432"
     DATA "the_geom from (select eid, the_geom from edges1) as foo using 
unique eid"
     LABELITEM 'eid'
     CLASS
       STYLE
         COLOR 87 87 87
         WIDTH 1
       END
       LABEL
         TYPE BITMAP
         SIZE small
         COLOR 0 0 0
     END
   END

   LAYER
     NAME "One_Way_Arrows"
     STATUS DEFAULT
     TYPE LINE
     CONNECTIONTYPE postgis
     CONNECTION "user=postgres dbname=trsp_test host=localhost port=5432"
     DATA "the_geom from (select eid, dir, the_geom from edges1 where 
dir != 'B' as foo using unique eid"
     CLASSITEM 'one_way'
     CLASS
       NAME 'From'
       EXPRESSION "FT"
       STYLE
         SYMBOL "one_way_from"
         COLOR 80 80 80
         SIZE 8
         GAP -40
       END
     END
     CLASS
       NAME 'To'
       EXPRESSION "TF"
       STYLE
         SYMBOL "one_way_to"
         COLOR 80 80 80
         SIZE 8
         GAP -40
       END
     END
   END

END


More information about the mapserver-dev mailing list