Skip to content

With turn costs something requires a lot more memory on import #916

Closed

Description

@karussell

If I just want to import a city (~50MB source map) and import this with car, without turn costs and 1g RAM, then all is fine. But with turn_costs=true the import fails with:

2016-12-21 10:48:31,271 [main] INFO  com.graphhopper.reader.osm.GraphHopperOSM - using car|RAM_STORE|2D|turn_cost|,,,,, memory:totalMB:981, usedMB:46
Exception in thread "pool-3-thread-2" java.lang.OutOfMemoryError: GC overhead limit exceeded
	at com.graphhopper.reader.ReaderElement.<init>(ReaderElement.java:40)
	at com.graphhopper.reader.ReaderNode.<init>(ReaderNode.java:42)
	at com.graphhopper.reader.osm.pbf.PbfBlobDecoder.processNodes(PbfBlobDecoder.java:238)

As the overhead of turn costs should be neglectable and the import itself should work with <500MB this seems to be a bug.

See also "Why do we have static edge and node IDs" #556

Activity

  1. added this to the 0.9 milestone on Dec 21, 2016
  2. karussell commented on Dec 21, 2016

    @karussell
    MemberAuthor

    Interesting reason. It looks like the reading is just faster then the graph creation and due to the unbounded (ouch!) queue PbfDecoder.blobResults we get many objects in this list, leading to the high memory usage.

    A workaround via setting datareader.worker_threads=1 does work (the commit below is required -> we had code which prevent lower than 2 worker threads inside OSMInputFile). Then the import will work with 1g but still not with less!

    We need to fix:

    • use a bounded & blocking queue for PbfDecoder.blobResults
    • look for potentially faster graph creation when turn costs are enabled
  3. karussell commented on Jan 13, 2017

    @karussell
    MemberAuthor

    Can only reproduce it for the pbf 'Muenchen' but not for much larger areas like sachsen or bavaria. This is due to a large size of many "primitive groups". See PbfBlobDecoder.processOsmPrimitives ... will print a warning for this case.

  4. added and removed on Jan 13, 2017
  5. boldtrn commented on Jan 17, 2017

    @boldtrn
    Member

    Has anyone experience with the warning we print right now?

    When I run bigger imports, there are tons of warnings like that:
    2017-01-18 00:08:01,189 [pool-4-thread-2] WARN com.graphhopper.reader.osm.pbf.PbfBlobDecoder - Processing unusual large OSM primitive group could result in memory problems, workaround is to increase -Xmx and see #916. nodes:2613147 | 1740227, 0, ways: 0, rels:0

    Anyone else having this issue? Can this warning be ignored or might it point out an actual issue with my PBF? I extract a part of the planet.osm.pbf.

    A workaround via setting datareader.worker_threads=1 does work

    Is this still true? Or is this fixed?

  6. karussell commented on Jan 18, 2017

    @karussell
    MemberAuthor

    The workaround was regarding the higher memory consumption. The underlying issue is that your pbf (as well as my example) seem to have several times bigger blobs than usual which causes a very high memory requirement, but this is only strange for small areas. So it might be good to avoid this warning completely.

  7. boldtrn commented on Jan 19, 2017

    @boldtrn
    Member

    Thanks for clearing this up. Not sure, I was just wondering as my log was completely cluttered with this information.

  8. karussell commented on Jan 19, 2017

    @karussell
    MemberAuthor

    We have to remove this warning, as large PBFs seem to have large blobs ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions