[OSM-dev] Stack Overflow in mkgmap

Rainer Rothkegel rainer.rothkegel at googlemail.com
Sun Apr 6 07:28:45 BST 2008


Ludwig wrote:
> I have no particular experience with the mkgmap application, but from 
> using cgpsmapper for making maps I know that using too large an area 
> will often fail.
>
> There is however a simple way of combining individually created 
> non-overlapping maps into a larger map, using a program called 
> gmaptool (http://www.anpo.republika.pl/download.html). It is a simple 
> command line application. I have used this successfully to combine 
> maps created from OSM data into a larger file.
>
> HTH
>
> Ludwig
>
> On 26/03/2008, *Rainer Rothkegel* <rainer.rothkegel at googlemail.com 
> <mailto:rainer.rothkegel at googlemail.com>> wrote:
>
>     I get a StackOverflow Exception when trying to create a Garmin map for
>     India.
>     I downloaded the India map data via
>     wget
>     http://www.informationfreeway.org/api/0.5/*[bbox=67.28027,5.35352,89.07715,33.39476]
>     <http://www.informationfreeway.org/api/0.5/*%5Bbbox=67.28027,5.35352,89.07715,33.39476%5D>
>     -O india-osmxapi.osm
>
>     This resulted in a 130M osm file.
>
>     Then I tried to convert it to a Garmin map file via
>     java -Xmx512M -jar /home/rainer/gps/osm/mkgmap/dist/mkgmap.jar
>     --gmapsupp --description="OSM India Map $(date)" india-osmxapi.osm
>
>     After a few minutes of processing, I got the following stack trace:
>
>     Exception in thread "main" java.lang.StackOverflowError
>             at java.util.ArrayList.toArray(ArrayList.java:306)
>             at java.util.logging.Logger.getHandlers(Logger.java:1214)
>             at
>     java.util.logging.LogManager$RootLogger.getHandlers(LogManager.java:995)
>             at java.util.logging.Logger.log(Logger.java:468)
>             at java.util.logging.Logger.doLog(Logger.java:494)
>             at java.util.logging.Logger.log(Logger.java:517)
>             at uk.me.parabola.log.Logger.arrayFormat(Logger.java:213)
>             at uk.me.parabola.log.Logger.warn(Logger.java:183)
>             at
>     uk.me.parabola.mkgmap.build.MapArea.pickArea(MapArea.java:503)
>             at uk.me.parabola.mkgmap.build.MapArea.split(MapArea.java:218)
>             at
>     uk.me.parabola.mkgmap.build.MapSplitter.addAreasToList(MapSplitter.java:111)
>             at
>     uk.me.parabola.mkgmap.build.MapSplitter.addAreasToList(MapSplitter.java:112)
>             at
>     uk.me.parabola.mkgmap.build.MapSplitter.addAreasToList(MapSplitter.java:112)
>     [last line repeated for zillions of times]
>
>
>     I checked out the source code and found that line 112 of
>     MapSplitter.java is the following recursion:
>     addAreasToList(sublist, alist);
>
>     I am currently running the mkgmap in debug mode using the default
>     logging properties (java
>     -Dlog.config=mkgmap/dist/resources/logging.properties ...) but
>     (probably  due to the high volume of data being logged) the
>     application
>     has run for more than 1 hour without terminating yet.
>
>     My question: Is this likely a data problem or a problem with mkgmap?
>     (Btw. creating a Garmin map file works fine if I process only the data
>     for south India.)
>
>     Thanks in advance,
>     Rainer
>
>
>     _______________________________________________
>     dev mailing list
>     dev at openstreetmap.org <mailto:dev at openstreetmap.org>
>     http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev
>
>

It does not seem to be related to map size. I modified the log 
statements in mkgmap a bit to get a clearer picture. Here is the 
relevant portion of the log:

2008/04/06 11:09:05 INFO (MapSplitter): no split for area with size  0  
bounds (19.24926996231079,92.21398115158081) to 
(19.853453636169434,92.74720430374146)
2008/04/06 11:09:05 INFO (MapSplitter): splitting area with size  94269  
bounds (19.853453636169434,79.95034217834473) to 
(20.457615852355957,80.48354387283325)
2008/04/06 11:09:05 INFO (MapSplitter): splitting area with size  88725  
bounds (19.853453636169434,79.95034217834473) to 
(20.155534744262695,80.21693229675293)
2008/04/06 11:09:05 INFO (MapSplitter): splitting area with size  88725  
bounds (19.853453636169434,79.95034217834473) to 
(20.004494190216064,80.08363723754883)
2008/04/06 11:09:05 INFO (MapSplitter): splitting area with size  86016  
bounds (19.853453636169434,79.95034217834473) to 
(19.92896318435669,80.01698970794678)
2008/04/06 11:09:05 INFO (MapSplitter): splitting area with size  86016  
bounds (19.853453636169434,79.95034217834473) to 
(19.891197681427002,79.98366594314575)
2008/04/06 11:09:05 INFO (MapSplitter): splitting area with size  86016  
bounds (19.853453636169434,79.95034217834473) to 
(19.872314929962158,79.96699333190918)
2008/04/06 11:09:05 INFO (MapSplitter): splitting area with size  86016  
bounds (19.853453636169434,79.95034217834473) to 
(19.862873554229736,79.95866775512695)
2008/04/06 11:09:05 INFO (MapSplitter): splitting area with size  86016  
bounds (19.853453636169434,79.95034217834473) to 
(19.858152866363525,79.95450496673584)
2008/04/06 11:09:05 INFO (MapSplitter): splitting area with size  86016  
bounds (19.853453636169434,79.95034217834473) to 
(19.85579252243042,79.95242357254028)
2008/04/06 11:09:05 INFO (MapSplitter): splitting area with size  86016  
bounds (19.853453636169434,79.95034217834473) to 
(19.854612350463867,79.95137214660645)
2008/04/06 11:09:05 INFO (MapSplitter): splitting area with size  86016  
bounds (19.853453636169434,79.95034217834473) to 
(19.85403299331665,79.95085716247559)
2008/04/06 11:09:05 INFO (MapSplitter): splitting area with size  86016  
bounds (19.853453636169434,79.95034217834473) to 
(19.853732585906982,79.95059967041016)
2008/04/06 11:09:05 INFO (MapSplitter): splitting area with size  86016  
bounds (19.853453636169434,79.95034217834473) to 
(19.85358238220215,79.95047092437744)
2008/04/06 11:09:05 INFO (MapSplitter): splitting area with size  86016  
bounds (19.853453636169434,79.95034217834473) to 
(19.85351800918579,79.95040655136108)
2008/04/06 11:09:05 INFO (MapSplitter): splitting area with size  86016  
bounds (19.853453636169434,79.95034217834473) to 
(19.853475093841553,79.95036363601685)
2008/04/06 11:09:05 INFO (MapSplitter): splitting area with size  86016  
bounds (19.853453636169434,79.95034217834473) to 
(19.853475093841553,79.95036363601685)
2008/04/06 11:09:05 INFO (MapSplitter): splitting area with size  86016  
bounds (19.853453636169434,79.95034217834473) to 
(19.853475093841553,79.95036363601685)

If you look at the last 3 lines, you see that the bounds of the split 
area are identical to the bounds of the unsplit area. Obviously, this 
must result in stack overflow.

Cheers, Rainer





More information about the dev mailing list