SWIGMapscript: glibc detected malloc memory corruption

Umberto Nicoletti umberto.nicoletti at GMAIL.COM
Mon Jun 27 04:45:23 EDT 2005


Next time please reply to the list too (the mailin list admin could
setup the list software so that it rewrites the reply-to field and
make the list work like all other lists I've subscribed to).

Comments inline.

On 6/27/05, Geo-IT GmbH <info at geo-it.com> wrote:
> Hi Umberto,
> Thanks for your reply.
> I am using SuSE 9.3 i686 (32 Bit).
> After some additional tests I found that among others it has something to do
> with the data and the projection of the data. Therefore I meanwhile managed to
> get the testprogram running (the one attached in my mail) but it is still
> falling over when trying to do the same thing from within a servlet.

What configure options did you use?
In particular have you enabled the thread locks with use-threads?

Notice: since 4.4.something it is not necessary to load the library
anymore as that is done in the mapscript.jar.

Regards,
Umberto

> That is
> not my first Java Servlet program using mapscript functions, so I could claim
> to be no novice to java mapscript. But up to and including mapserver version
> 4.0 I used the processTemplate, and processQueryTemplate methods to generate
> result HTML pages but this is no longer working since 4.2. (I reported this
> bug, but it seems to be more complex than expected to solve this). Therefore
> it's the first time to fetch the results of a query one after one and filling
> a template manually.
> 
> I'll try the MALLOC_CHECK_ variable and read through the malloc man page.
> 
> Mit freundlichen Gruessen/Kind regards
> Andreas Paukner-Ruzicka
> (Geschaeftsfuehrer/Managing director)
> 
> **********************************************************
> Geo-IT GmbH   -   Geoinformatik, IT-Services
> Guggenberg 3, D-82380 Peissenberg
> Tel: 08803-498372, Fax: 08803-498373
> eMail: info at geo-it.com  -  Homepage: http://www.geo-it.com
> **********************************************************
> 
> 
> On Mon, June 27, 2005 9:47, Umberto Nicoletti said:
> > What distro are you using (this appears to be a detail too often forgotten) ?
> >
> > See if you have a MALLOC_CHECK_ env variable set and then read
> > malloc's man page.
> >
> > Regards,
> > Umberto
> >
> > On 6/26/05, Geo-IT GmbH <info at geo-it.com> wrote:
> >> Dear experts,
> >> When trying to fetch a shapeObj after a queryByPoint using the shapeindex
> >> and
> >> tileindex from the resultCache in a Java mapscript program I get the
> >> following
> >> error terminating the whole VM:
> >>
> >> *** glibc detected *** malloc(): memory corruption: 0x08314ed0 ***
> >> ./runshapetest40.sh: line 13: 26946 Aborted java ShapeObjTest40 $mapfile
> >> $layername
> >>
> >> The program was:
> >>
> >> // Standard imports
> >> import java.io.*;
> >> import java.util.*;
> >> import java.text.*;
> >> import edu.umn.gis.mapscript.*;
> >>
> >> public class ShapeObjTest {
> >>
> >>         String mapFile = null;
> >>         String layerName = null;
> >>
> >>
> >> static {
> >>         try {
> >>                 System.loadLibrary("mapscript");
> >>                 System.out.println("Mapscript lib loaded");
> >>         } catch (UnsatisfiedLinkError e) {
> >>                 e.printStackTrace();
> >>                 System.exit(1);
> >>         }
> >> }
> >>
> >>         public ShapeObjTest() {
> >>         }
> >>
> >>
> >>         protected static void log(String msg) {
> >>                 System.out.println(msg);
> >>         }
> >>         protected static void usage() {
> >>                 System.out.println("USAGE: ShapeObjTest <mapfile>
> >> <layername>");
> >>         }
> >>
> >>         public static void main (String args[] ) {
> >>                 if (args == null || args.length < 2) {
> >>                         usage();
> >>                         System.exit(1);
> >>                 }
> >>                 String mapFile = args[0];
> >>                 String layerName = args[1];
> >>         try {
> >>                 log("Creating map");
> >>                 mapObj map = new mapObj(mapFile);
> >>                 layerObj l = map.getLayerByName(layerName);
> >>                 l.open();
> >>                 log("Fetching shapeObj shapeindex 1 tileindex -1");
> >>                 shape = l.getFeature(1,-1);
> >>                 l.close();
> >>                 log("Fetch successful");
> >>         } catch (Exception ie) {
> >>                 ie.printStackTrace();
> >>                 System.exit(1);
> >>         }
> >>         }
> >> }
> >>
> >> The log shows:
> >> Mapscript lib loaded
> >> Creating map
> >> Fetching shapeObj shapeindex 1 tileindex -1
> >>
> >> Then the error appears on the console.
> >>
> >> I use mapserver 4.6.0.
> >>
> >> This is the mapfile: (It's the one from Itasca demo, but only with layer
> >> airports)
> >> MAP
> >>   #
> >>   # Start of map file
> >>   #
> >>   NAME "DEMO"
> >>   STATUS ON
> >>   EXTENT 388107.634400379 5203120.88405952 500896.339019834 5310243.30613897
> >>   SIZE 600 600
> >>   SHAPEPATH "data"
> >>   IMAGECOLOR 255 255 255
> >>   UNITS METERS
> >>   # you may need to change this to match your MapServer build
> >>   #IMAGETYPE PNG
> >>   #
> >>   # Projection definition, consult the PROJ.4 documentation for parameter
> >> discussion
> >>   #
> >>   PROJECTION
> >>     "proj=utm"
> >>     "ellps=GRS80"
> >>     "zone=15"
> >>     "north"
> >>     "no_defs"
> >>
> >> #  OR:
> >>   #
> >>   #  "init=epsg:26915"
> >>   END
> >>   #
> >>   # Start of web interface definition (including WMS enabling metadata)
> >>   #
> >>   WEB
> >>     MINSCALE 1000
> >>     MAXSCALE 1550000
> >>     IMAGEPATH "/tmp"
> >>     IMAGEURL "/tmp"
> >>     HEADER "demo_header.html"
> >>     FOOTER "demo_footer.html"
> >>     TEMPLATE "demo.html"
> >>     METADATA
> >>       "WMS_TITLE"    "UMN MapServer Itasca Demo"
> >>       "WMS_ABSTRACT"    "This is the UMN MapServer demonstration application
> >> for Itasca County located in north central Minnesota."
> >>       "WMS_ACCESSCONSTRAINTS"    "none"
> >>       "WMS_ONLINERESOURCE"
> >> "http://localhost.localdomain/mapserver_demos/itasca/demo_init.html"
> >>       "WMS_SRS"    "EPSG:26915"
> >>     END
> >>   END
> >>   #
> >>   # Start of reference map
> >>   #
> >>   REFERENCE
> >>     STATUS ON
> >>     IMAGE "graphics/reference.gif"
> >>     SIZE 120 120
> >>     EXTENT 393234.393701263 5205405.16440722 495769.579718949
> >> 5307959.02579127
> >>     COLOR -1 -1 -1
> >>     OUTLINECOLOR 255 0 0
> >>   END
> >>   QUERYMAP
> >>     STATUS ON
> >>     SIZE 200 200
> >>     COLOR 255 0 0
> >>     STYLE HILITE
> >>   END
> >>   #
> >>   # Start of legend
> >>   #
> >>   LEGEND
> >>     STATUS ON
> >>     KEYSIZE 18 12
> >>     LABEL
> >>       TYPE BITMAP
> >>       SIZE MEDIUM
> >>       COLOR 0 0 89
> >>     END
> >>   END
> >>   #
> >>   # Start of scalebar
> >>   #
> >>   SCALEBAR
> >>     STATUS ON
> >>     COLOR 0 102 102
> >>     OUTLINECOLOR 102 255 0
> >>     BACKGROUNDCOLOR 255 51 102
> >>     IMAGECOLOR 255 255 255
> >>     TRANSPARENT OFF
> >>     UNITS MILES
> >>     INTERVALS 1
> >>     SIZE 80 2
> >>     STYLE 1
> >>     INTERLACE ON
> >>     LABEL
> >>       TYPE BITMAP
> >>       SIZE MEDIUM
> >>       COLOR 0 0 0
> >>     END
> >>   END
> >>   #
> >>   # Start of symbol definitions (we're only using a few)
> >>   #
> >>   SYMBOL
> >>     NAME "circle"
> >>     TYPE ELLIPSE
> >>     FILLED TRUE
> >>     POINTS
> >>        1 1
> >>     END
> >>   END
> >>   #
> >>   # Start of layer definitions
> >>   #
> >>   LAYER
> >>     NAME "airports"
> >>     STATUS OFF
> >>     DATA "airports"
> >>     TYPE POINT
> >>     TOLERANCE 5
> >>     HEADER "airports_header.html"
> >>     FOOTER "airports_footer.html"
> >>     TEMPLATE "ttt.html"
> >>     METADATA
> >>       "WMS_TITLE"    "Airports"
> >>       "WMS_ABSTRACT"    "Airport runways for Itasca County."
> >>       "WMS_SRS"    "EPSG:26915"
> >>     END
> >>     CLASS
> >>       NAME "Airports"
> >>       SYMBOL "circle"
> >>       COLOR 128 255 164
> >>       SIZE 7
> >>       TEMPLATE "airports.html"
> >>     END
> >>   END
> >>
> >>
> >>
> >> Any help would be greatly appreciated.
> >>
> >> Mit freundlichen Gruessen/Kind regards
> >> Andreas Paukner-Ruzicka
> >> (Geschaeftsfuehrer/Managing director)
> >>
> >> **********************************************************
> >> Geo-IT GmbH   -   Geoinformatik, IT-Services
> >> Guggenberg 3, D-82380 Peissenberg
> >> Tel: 08803-498372, Fax: 08803-498373
> >> eMail: info at geo-it.com  -  Homepage: http://www.geo-it.com
> >> **********************************************************
> >>
> >
> 
> 
>



More information about the mapserver-users mailing list