OutOfMemoryEror at build time

Hello I am trying to get my own instance of ORS running on a local Ubuntu 22.04 server with Java 21 (32GB RAM). I do not use Docker but rather follow instructions to build from source and use mvn spring-boot:run

It all goes smoothly if I only enable profile driving-car. However, I get an OutOfMemoryException if I try to include the foot-hiking profile as well (or the foot-walking one). This happens at build time. I have pasted the relevant part of the build log at the end of this post.

I have tried to increase the memory parameters of Maven using MAVEN_OPTS=“-Xmx16386m -Xms8192m” but this does not seem to change anything.

As can be seen in the log below, the memory available to that part of the build process seems to remain much lower:

using hiking_ors|RAM_STORE|3D|turn_cost|, memory:totalMB:5860, usedMB:4129

Any advice on how to fix this? thank you

+++++++++++++++++ Larger log:++++++++++++++++

2024-05-27 15:26:35 INFO ORS-pl-car [ o.h.o.r.RoutingProfile ] [1] Edges: 13682892 - Nodes: 11285438.
2024-05-27 15:26:35 INFO ORS-pl-car [ o.h.o.r.RoutingProfile ] [1] Total time: 4.856s.
2024-05-27 15:26:35 INFO ORS-pl-car [ o.h.o.r.RoutingProfile ] [1] Finished at: 2024-05-27 15:26:35.
2024-05-27 15:26:35 INFO ORS-pl-hiking [ o.h.o.r.RoutingProfile ] [2] Profiles: ‘foot-hiking’, location: ‘/home/ilda/projects/openrouteservice-8.0.1/./graphs/hiking’.
2024-05-27 15:26:35 INFO ORS-pl-hiking [ o.h.o.r.g.e.ORSGraphHopper ] version v4.9.1|2024-01-17T09:08:46Z (7,20,5,4,5,7)
2024-05-27 15:26:35 INFO ORS-pl-hiking [ o.h.o.r.g.e.ORSGraphHopper ] graph hiking_ors|RAM_STORE|3D|turn_cost|, details:edges:0(0MB), nodes:0(0MB), name:(0MB), geo:0(0MB), bounds:1.7976931348623157E308,-1.7976931348623157E308,1.7976931348623157E308,-1.7976931348623157E308,1.7976931348623157E308,-1.7976931348623157E308
2024-05-27 15:26:35 INFO ORS-pl-hiking [ o.h.o.r.g.e.ORSGraphHopper ] No custom areas are used, custom_areas.directory not given
2024-05-27 15:26:35 INFO ORS-pl-hiking [ o.h.o.r.g.e.ORSGraphHopper ] start creating graph from /home/ilda/projects/data/france-latest.osm.pbf
2024-05-27 15:26:35 INFO ORS-pl-hiking [ o.h.o.r.g.e.ORSGraphHopper ] using hiking_ors|RAM_STORE|3D|turn_cost|, memory:totalMB:5860, usedMB:4129
2024-05-27 15:34:01 WARN ORS-pl-hiking [ c.g.r.o.OSMReader ] Parsing error in way with OSMID=370073667 : Cannot parse duration tag value: 5 minutes
2024-05-27 15:38:27 ERROR ORS-Init [ o.h.o.r.RoutingProfileManager ]
2024-05-27 15:38:28 ERROR ORS-Init [ o.h.o.r.RoutingProfileManager ] Failed to either read or execute the ors configuration and its parameters: java.lang.OutOfMemoryError: Java heap space
2024-05-27 15:38:28 ERROR ORS-Init [ o.h.o.r.RoutingProfileManager ]

You might want to try adjusting the JAVA_OPTS environment variable as documented here. Cheers!

Thanks. I tried, but this did not fix the issue. I have my JAVA_OPTS=“-Xms12g -Xmx12g” but still get a java.lang.OutOfMemoryError: Java heap space from ORS-Init [ o.h.o.r.RoutingProfileManager

What I find a bit strange is that whatever I set as Xmx value, for both MAVEN_OPT and JAVA_OPTS, I always get the same memory allocation msg when running mvn spring-boot:run:

2024-05-28 11:12:19 INFO ORS-Init [ o.h.o.r.RoutingProfileManager ] Total - 296 MB, Free - 213.88 MB, Max: 7.76 GB, Used - 82.12 MB

and when monitoring the process from the Gnome System Monitor it definitely never goes above 8.6GB.

Any idea why?
thanks!

I eventually managed to run everything through docker, and there I can set the Xms and Xmx easily. Problem solved, indirectly.

3 Likes