Localhost config for foot-walking

Hi,

I’m sorry to bother again after little time, but is the first time that I have to do this kind of stuff.
I managed to configure ORS for driving-car and everything is working. I’m using Docker, nord-ovest-latest.osm.pbf (Italy) and everything is right both through postman and the ORS Tools.

What is not working is the configuration of the new profile for foot-walking.
Starting from SyntaxByte’s video, I modified my ors.conf adding “walking”:

{
  "ors": {
    "info": {
      "base_url": "https://openrouteservice.org/",
      "support_mail": "support@openrouteservice.org",
      "author_tag": "openrouteservice",
      "content_licence": "LGPL 3.0"
    },
    "services": {
      "matrix": {
        "enabled": true,
        "maximum_routes": 100,
        "maximum_routes_flexible": 25,
        "maximum_search_radius": 5000,
        "maximum_visited_nodes": 100000,
        "allow_resolve_locations": true,
        "attribution": "openrouteservice.org, OpenStreetMap contributors"
      },
      "isochrones": {
        "enabled": true,
        "maximum_range_distance": [
          {
            "profiles": "any",
            "value": 50000
          },
          {
            "profiles": "driving-car, driving-hgv",
            "value": 100000
          }
        ],
        "maximum_range_time": [
          {
            "profiles": "any",
            "value": 18000
          },
          {
            "profiles": "driving-car, driving-hgv",
            "value": 3600
          }
        ],
        "fastisochrones": {
          "maximum_range_distance": [
            {
              "profiles": "any",
              "value": 50000
            },
            {
              "profiles": "driving-car, driving-hgv",
              "value": 500000
            }
          ],
          "maximum_range_time": [
            {
              "profiles": "any",
              "value": 18000
            },
            {
              "profiles": "driving-car, driving-hgv",
              "value": 10800
            }
          ],
          "profiles": {
            "default_params": {
              "enabled": false,
              "threads": 12,
              "weightings": "recommended",
              "maxcellnodes": 5000
            },
            "profile-hgv": {
              "enabled": false,
              "threads": 12,
              "weightings": "recommended, shortest",
              "maxcellnodes": 5000
            }
          }
        },
        "maximum_intervals": 10,
        "maximum_locations": 2,
        "allow_compute_area": true
      },
      "routing": {
        "enabled": true,
        "mode": "normal",
        "routing_description": "This is a routing file from openrouteservice",
        "routing_name": "openrouteservice routing",
        "sources": [
          "data/osm_file.pbf"
        ],
        "init_threads": 1,
        "attribution": "openrouteservice.org, OpenStreetMap contributors",
        "elevation_preprocessed": false,
        "profiles": {
          "active": [
            "car",
            "walking"
          ],
          "default_params": {
            "encoder_flags_size": 8,
            "graphs_root_path": "data/graphs",
            "elevation_provider": "multi",
            "elevation_cache_path": "data/elevation_cache",
            "elevation_cache_clear": false,
            "instructions": true,
            "maximum_distance": 100000,
            "maximum_distance_dynamic_weights": 100000,
            "maximum_distance_avoid_areas": 100000,
            "maximum_waypoints": 50,
            "maximum_snapping_radius": 400,
            "maximum_avoid_polygon_area": 200000000,
            "maximum_avoid_polygon_extent": 20000,
            "maximum_distance_alternative_routes": 100000,
            "maximum_alternative_routes": 3,
            "maximum_distance_round_trip_routes": 100000,
            "maximum_speed_lower_bound": 80,
            "preparation": {
              "min_network_size": 200,
              "min_one_way_network_size": 200,
              "methods": {
                "lm": {
                  "enabled": true,
                  "threads": 1,
                  "weightings": "recommended,shortest",
                  "landmarks": 16
                }
              }
            },
            "execution": {
              "methods": {
                "lm": {
                  "disabling_allowed": true,
                  "active_landmarks": 8
                }
              }
            }
          },
          "profile-car": {
            "profiles": "driving-car",
            "parameters": {
              "encoder_flags_size": 8,
              "encoder_options": "turn_costs=true|block_fords=false|use_acceleration=true",
              "maximum_distance": 100000,
              "elevation": true,
              "maximum_snapping_radius": 350,
              "preparation": {
                "min_network_size": 200,
                "min_one_way_network_size": 200,
                "methods": {
                  "ch": {
                    "enabled": true,
                    "threads": 1,
                    "weightings": "fastest"
                  },
                  "lm": {
                    "enabled": false,
                    "threads": 1,
                    "weightings": "fastest,shortest",
                    "landmarks": 16
                  },
                  "core": {
                    "enabled": true,
                    "threads": 1,
                    "weightings": "fastest,shortest",
                    "landmarks": 64,
                    "lmsets": "highways;allow_all"
                  }
                }
              },
              "execution": {
                "methods": {
                  "ch": {
                    "disabling_allowed": true
                  },
                  "lm": {
                    "disabling_allowed": true,
                    "active_landmarks": 6
                  },
                  "core": {
                    "disabling_allowed": true,
                    "active_landmarks": 6
                  }
                }
              },
              "ext_storages": {
                "WayCategory": {},
                "HeavyVehicle": {},
                "WaySurfaceType": {},
                "RoadAccessRestrictions": {
                  "use_for_warnings": true
                }
              }
            }
          },
          "profile-hgv": {
            "profiles": "driving-hgv",
            "parameters": {
              "encoder_flags_size": 8,
              "encoder_options": "turn_costs=true|block_fords=false|use_acceleration=true",
              "maximum_distance": 100000,
              "elevation": true,
              "preparation": {
                "min_network_size": 200,
                "min_one_way_network_size": 200,
                "methods": {
                  "ch": {
                    "enabled": true,
                    "threads": 1,
                    "weightings": "recommended"
                  },
                  "core": {
                    "enabled": true,
                    "threads": 1,
                    "weightings": "recommended,shortest",
                    "landmarks": 64,
                    "lmsets": "highways;allow_all"
                  }
                }
              },
              "execution": {
                "methods": {
                  "ch": {
                    "disabling_allowed": true
                  },
                  "core": {
                    "disabling_allowed": true,
                    "active_landmarks": 6
                  }
                }
              },
              "ext_storages": {
                "WayCategory": {},
                "HeavyVehicle": {
                  "restrictions": true
                },
                "WaySurfaceType": {}
              }
            }
          },
          "profile-bike-regular": {
            "profiles": "cycling-regular",
            "parameters": {
              "encoder_options": "consider_elevation=true|turn_costs=true|block_fords=false",
              "elevation": true,
              "ext_storages": {
                "WayCategory": {},
                "WaySurfaceType": {},
                "HillIndex": {},
                "TrailDifficulty": {}
              }
            }
          },
          "profile-bike-mountain": {
            "profiles": "cycling-mountain",
            "parameters": {
              "encoder_options": "consider_elevation=true|turn_costs=true|block_fords=false",
              "elevation": true,
              "ext_storages": {
                "WayCategory": {},
                "WaySurfaceType": {},
                "HillIndex": {},
                "TrailDifficulty": {}
              }
            }
          },
          "profile-bike-road": {
            "profiles": "cycling-road",
            "parameters": {
              "encoder_options": "consider_elevation=true|turn_costs=true|block_fords=false",
              "elevation": true,
              "ext_storages": {
                "WayCategory": {},
                "WaySurfaceType": {},
                "HillIndex": {},
                "TrailDifficulty": {}
              }
            }
          },
          "profile-bike-electric": {
            "profiles": "cycling-electric",
            "parameters": {
              "encoder_options": "consider_elevation=true|turn_costs=true|block_fords=false",
              "elevation": true,
              "ext_storages": {
                "WayCategory": {},
                "WaySurfaceType": {},
                "HillIndex": {},
                "TrailDifficulty": {}
              }
            }
          },
          "profile-walking": {
            "profiles": "foot-walking",
            "parameters": {
              "encoder_options": "block_fords=false",
              "elevation": true,
              "ext_storages": {
                "WayCategory": {},
                "WaySurfaceType": {},
                "HillIndex": {},
                "TrailDifficulty": {}
              }
            }
          },
          "profile-hiking": {
            "profiles": "foot-hiking",
            "parameters": {
              "encoder_options": "block_fords=false",
              "elevation": true,
              "ext_storages": {
                "WayCategory": {},
                "WaySurfaceType": {},
                "HillIndex": {},
                "TrailDifficulty": {}
              }
            }
          },
          "profile-wheelchair": {
            "profiles": "wheelchair",
            "parameters": {
              "encoder_options": "block_fords=true",
              "elevation": true,
              "maximum_snapping_radius": 50,
              "ext_storages": {
                "WayCategory": {},
                "WaySurfaceType": {},
                "Wheelchair": {
                  "KerbsOnCrossings": "true"
                },
                "OsmId": {}
              }
            }
          }
        }
      }
    },
    "logging": {
      "enabled": true,
      "level_file": "DEBUG_LOGGING.json",
      "location": "/var/log/ors",
      "stdout": true
    },
    "system_message": [
      {
        "active": false,
        "text": "This message would be sent with every routing bike fastest request",
        "condition": {
          "request_service": "routing",
          "request_profile": "cycling-regular,cycling-mountain,cycling-road,cycling-electric",
          "request_preference": "fastest"
        }
      },
      {
        "active": false,
        "text": "This message would be sent with every request for geojson response",
        "condition": {
          "api_format": "geojson"
        }
      },
      {
        "active": false,
        "text": "This message would be sent with every request on API v1 from January 2020 until June 2050",
        "condition": {
          "api_version": 1,
          "time_after": "2020-01-01T00:00:00Z",
          "time_before": "2050-06-01T00:00:00Z"
        }
      },
      {
        "active": false,
        "text": "This message would be sent with every request"
      }
    ]
  }
}

Then, I changed my docker-compose setting “True” for BUILD_GRAPHS and then docker compose up. Took a long time but after that I was able to perform only operations with driving-car. Looking some similar questions here, I changed ./conf:/ors-conf in ./conf:/ors-conf:ro. Again, took a long time for the server to start but nothing changed.
I’m quite sure I’m missing some kind of parameter and I already read that Dockerfile is set in
# Delete all profiles but car jq 'del(.ors.services.routing.profiles.active[1,2,3,4,5,6,7,8])' /ors-core/openrouteservice/src/main/resources/ors-config.json |sponge /ors-core/openrouteservice/src/main/resources/ors-config.json
but I honestly do not know what I’m missing.
This is one of the logs trying to perform Isochrones from ORS QGIS plugin.

After one run, I turned False again my BUILD_GRAPHS considering that it takes what has already been calculated once.

After these changes, starting the server has started to take a long. Besides, http://localhost:8080/ors/v2/health is kinda stucked in “not ready” (even though driving-car works fine).

Thanks again for your support and kindness

Hey,

can you check whether your graphs-folder (in the container) contains a walking folder? If not, the ors hasn’t built the graphs.

Also, could you post the actual error that the QGIS plugin is giving (from the Log Messages-Console) or an error from any curl request?

Best regards

Hy,
I checked my openrouteservice > docker > graphs. Walking folder has been created but it hosts just these files:

this is my error (sorry but this is the only log i could find):

Versione di QGIS: 3.26.3-Buenos Aires
Revisione codice QGIS: 65e4edfdada
Versione di Qt: 5.15.3
Versione Python: 3.9.5
Versione di GDAL: 3.5.1
Versione di GEOS: 3.10.3-CAPI-1.16.1
Versione di PROJ: Rel. 9.1.0, September 1st, 2022
versione di PDAL: 2.4.3 (git-version: 6311a6)
Algoritmo iniziato alle: 2022-11-22T17:50:50
In avvio l'algoritmo 'Isochrones from layer' …
Parametri in ingresso:
{ 'INPUT_AVOID_BORDERS' : None, 'INPUT_AVOID_COUNTRIES' : '', 'INPUT_AVOID_FEATURES' : [], 'INPUT_AVOID_POLYGONS' : None, 'INPUT_FIELD' : '', 'INPUT_METRIC' : 0, 'INPUT_POINT_LAYER' : 'C:/Users/matti/Downloads/BDTRE_STRUTTURA_AGGREGATA_2022_2ed-GRUPPI_COMUNI-101-EPSG32632-GPKG/BDTRE_STRUTTURA_AGGREGATA_101.gpkg|layername=sed_amm_pt|geometrytype=Point', 'INPUT_PROFILE' : 6, 'INPUT_PROVIDER' : 1, 'INPUT_RANGES' : '5, 10', 'OUTPUT' : 'TEMPORARY_OUTPUT' }

Traceback (most recent call last):
File "C:\Users/matti/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ORStools\proc\isochrones_layer_proc.py", line 155, in processAlgorithm
response = ors_client.request('/v2/isochrones/' + profile, {}, post_json=params)
File "C:\Users/matti/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ORStools\common\client.py", line 189, in request
return json.loads(content.decode('utf-8'))
File "D:\Programmi\QGIS\apps\Python39\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "D:\Programmi\QGIS\apps\Python39\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "D:\Programmi\QGIS\apps\Python39\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Execution failed after 0.17 secondi

Caricamento layer
Algoritmo 'Isochrones from layer' terminato

Maybe I’m wrong, but can be just that it takes lots of time to populate this folder? When I started the docker there was just the location_index file (17:18).

Thanks

Yes, creating the graphs can indeed take quite some time, depending on your machine.
Have a look at /var/log/ors/ors.log in your container (or mount it locally to e.g. logs/ors as the compose file should do), it should give you an overview of the state of building graphs.

In QGIS you can enable the Log Messages Panel (Go to: View > Panels > Log Messages) where a tab for the ORS plugin should exist. This will show the request and the actual response sent, if I’m not mistaken.

Best regards

Thank you so much. This is the log I found in my logs/ors/ors.log directory:

2022-11-22 16:34:02,177 INFO [ors.Application] - Starting Application v6.8.0 on 33002a42b593 with PID 8 (/usr/local/tomcat/webapps/ors/WEB-INF/classes started by root in /ors-core)
2022-11-22 16:34:02,190 DEBUG [ors.Application] - Running with Spring Boot v2.3.5.RELEASE, Spring v5.2.10.RELEASE
2022-11-22 16:34:02,192 INFO [ors.Application] - No active profile set, falling back to default profiles: default
2022-11-22 16:34:06,109 INFO [ors.Application] - Started Application in 5.142 seconds (JVM running for 12.804)
2022-11-22 16:34:06,169 INFO [routing.RoutingProfileManager] -  Total - 1.00 GB, Free - 688.28 MB, Max: 2 GB, Used - 337.72 MB
2022-11-22 16:34:06,172 INFO [routing.RoutingProfileManager] -       
2022-11-22 16:34:06,203 INFO [routing.RoutingProfileManager] - ====> Initializing profiles from 'data/osm_file.pbf' (1 threads) ...
2022-11-22 16:34:06,204 INFO [routing.RoutingProfileManager] -                               
2022-11-22 16:34:06,212 INFO [routing.RoutingProfileManager] -                
2022-11-22 16:34:06,276 INFO [routing.RoutingProfile] - [1] Profiles: 'driving-car', location: 'data/graphs/car'.
2022-11-22 16:34:15,446 INFO [routing.RoutingProfile] - [1] FlagEncoders: 1, bits used [UNKNOWN]/64.
2022-11-22 16:34:15,448 INFO [routing.RoutingProfile] - [1] Capacity: [UNKNOWN]. (edges - 1711901, nodes - 1334170)
2022-11-22 16:34:15,449 INFO [routing.RoutingProfile] - [1] Total time: 9.173s.
2022-11-22 16:34:15,450 INFO [routing.RoutingProfile] - [1] Finished at: 2022-11-22 16:34:15.
2022-11-22 16:34:15,451 INFO [routing.RoutingProfile] -                               
2022-11-22 16:34:15,455 INFO [routing.RoutingProfile] - [2] Profiles: 'foot-walking', location: 'data/graphs/walking'.
2022-11-22 16:37:51,862 ERROR [routing.RoutingProfileManager] - java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.carrotsearch.hppc.BufferAllocationException: Not enough memory to allocate new buffers: 1,676,337 -> 2,514,505
2022-11-22 16:37:51,863 ERROR [routing.RoutingProfileManager] - Failed to initialize RoutingProfileManager instance.
java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.carrotsearch.hppc.BufferAllocationException: Not enough memory to allocate new buffers: 1,676,337 -> 2,514,505
	at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:?]
	at java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[?:?]
	at org.heigit.ors.routing.RoutingProfileManager.initialize(RoutingProfileManager.java:178) ~[classes/:6.8.0]
	at org.heigit.ors.routing.RoutingProfileManager.getInstance(RoutingProfileManager.java:72) ~[classes/:6.8.0]
	at org.heigit.ors.servlet.listeners.ORSInitContextListener.lambda$contextInitialized$0(ORSInitContextListener.java:41) ~[classes/:6.8.0]
	at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.carrotsearch.hppc.BufferAllocationException: Not enough memory to allocate new buffers: 1,676,337 -> 2,514,505
	at com.graphhopper.routing.lm.LMAlgoFactoryDecorator.loadOrDoWork(LMAlgoFactoryDecorator.java:303) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.GraphHopper.loadOrPrepareLM(GraphHopper.java:1396) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.GraphHopper.postProcessing(GraphHopper.java:954) ~[graphhopper-core-v0.13.23.jar:?]
	at org.heigit.ors.routing.graphhopper.extensions.ORSGraphHopper.postProcessing(ORSGraphHopper.java:682) ~[classes/:6.8.0]
	at com.graphhopper.GraphHopper.process(GraphHopper.java:703) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:680) ~[graphhopper-core-v0.13.23.jar:?]
	at org.heigit.ors.routing.graphhopper.extensions.ORSGraphHopper.importOrLoad(ORSGraphHopper.java:169) ~[classes/:6.8.0]
	at org.heigit.ors.routing.RoutingProfile.initGraphHopper(RoutingProfile.java:184) ~[classes/:6.8.0]
	at org.heigit.ors.routing.RoutingProfile.<init>(RoutingProfile.java:128) ~[classes/:6.8.0]
	at org.heigit.ors.routing.RoutingProfileLoader.call(RoutingProfileLoader.java:35) ~[classes/:6.8.0]
	at org.heigit.ors.routing.RoutingProfileLoader.call(RoutingProfileLoader.java:21) ~[classes/:6.8.0]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
	... 1 more
Caused by: java.util.concurrent.ExecutionException: com.carrotsearch.hppc.BufferAllocationException: Not enough memory to allocate new buffers: 1,676,337 -> 2,514,505
	at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:?]
	at java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[?:?]
	at com.graphhopper.routing.lm.LMAlgoFactoryDecorator.loadOrDoWork(LMAlgoFactoryDecorator.java:299) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.GraphHopper.loadOrPrepareLM(GraphHopper.java:1396) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.GraphHopper.postProcessing(GraphHopper.java:954) ~[graphhopper-core-v0.13.23.jar:?]
	at org.heigit.ors.routing.graphhopper.extensions.ORSGraphHopper.postProcessing(ORSGraphHopper.java:682) ~[classes/:6.8.0]
	at com.graphhopper.GraphHopper.process(GraphHopper.java:703) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:680) ~[graphhopper-core-v0.13.23.jar:?]
	at org.heigit.ors.routing.graphhopper.extensions.ORSGraphHopper.importOrLoad(ORSGraphHopper.java:169) ~[classes/:6.8.0]
	at org.heigit.ors.routing.RoutingProfile.initGraphHopper(RoutingProfile.java:184) ~[classes/:6.8.0]
	at org.heigit.ors.routing.RoutingProfile.<init>(RoutingProfile.java:128) ~[classes/:6.8.0]
	at org.heigit.ors.routing.RoutingProfileLoader.call(RoutingProfileLoader.java:35) ~[classes/:6.8.0]
	at org.heigit.ors.routing.RoutingProfileLoader.call(RoutingProfileLoader.java:21) ~[classes/:6.8.0]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
	... 1 more
Caused by: com.carrotsearch.hppc.BufferAllocationException: Not enough memory to allocate new buffers: 1,676,337 -> 2,514,505
	at com.carrotsearch.hppc.IntArrayDeque.ensureBufferSpace(IntArrayDeque.java:496) ~[hppc-0.8.1.jar:?]
	at com.carrotsearch.hppc.IntArrayDeque.addLast(IntArrayDeque.java:163) ~[hppc-0.8.1.jar:?]
	at com.graphhopper.routing.subnetwork.TarjansSCCAlgorithm.strongConnect(TarjansSCCAlgorithm.java:122) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.routing.subnetwork.TarjansSCCAlgorithm.findComponents(TarjansSCCAlgorithm.java:93) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.routing.lm.LandmarkStorage.createLandmarks(LandmarkStorage.java:264) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.routing.lm.PrepareLandmarks.doSpecificWork(PrepareLandmarks.java:130) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.routing.util.AbstractAlgoPreparation.doWork(AbstractAlgoPreparation.java:30) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.routing.lm.LMAlgoFactoryDecorator$1.run(LMAlgoFactoryDecorator.java:289) ~[graphhopper-core-v0.13.23.jar:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
	... 1 more
Caused by: java.lang.OutOfMemoryError: Java heap space
	at com.carrotsearch.hppc.IntArrayDeque.ensureBufferSpace(IntArrayDeque.java:486) ~[hppc-0.8.1.jar:?]
	at com.carrotsearch.hppc.IntArrayDeque.addLast(IntArrayDeque.java:163) ~[hppc-0.8.1.jar:?]
	at com.graphhopper.routing.subnetwork.TarjansSCCAlgorithm.strongConnect(TarjansSCCAlgorithm.java:122) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.routing.subnetwork.TarjansSCCAlgorithm.findComponents(TarjansSCCAlgorithm.java:93) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.routing.lm.LandmarkStorage.createLandmarks(LandmarkStorage.java:264) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.routing.lm.PrepareLandmarks.doSpecificWork(PrepareLandmarks.java:130) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.routing.util.AbstractAlgoPreparation.doWork(AbstractAlgoPreparation.java:30) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.routing.lm.LMAlgoFactoryDecorator$1.run(LMAlgoFactoryDecorator.java:289) ~[graphhopper-core-v0.13.23.jar:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
	... 1 more
2022-11-22 16:37:51,874 INFO [routing.RoutingProfileManager] - ====> Recycling garbage...
2022-11-22 16:37:51,877 INFO [routing.RoutingProfileManager] - Before:  Total - 2 GB, Free - 72.63 MB, Max: 2 GB, Used - 1.93 GB
2022-11-22 16:37:51,926 INFO [routing.RoutingProfileManager] - After:  Total - 2 GB, Free - 1.08 GB, Max: 2 GB, Used - 940.92 MB
2022-11-22 16:37:51,927 INFO [routing.RoutingProfileManager] - ========================================================================
2022-11-22 16:37:51,928 INFO [routing.RoutingProfileManager] - ====> Memory usage by profiles:
2022-11-22 16:37:51,938 INFO [routing.RoutingProfileManager] - [1] 376.03 MB (40.0%)
2022-11-22 16:37:51,939 INFO [routing.RoutingProfileManager] - Total: 376.03 MB (40.0%)
2022-11-22 16:37:51,939 INFO [routing.RoutingProfileManager] - ========================================================================
2022-11-22 16:38:45,907 INFO [util.SystemMessage] - SystemMessage loaded 0 messages.

To be clear, now to fix I should set BUILD-GRAPHS=True and restart my Docker, right? What I still miss is how can I find out that everything is finished.

Thanks again for your patience

Hey,

the essential line here is this one:

which means you should allocate more RAM to your docker instance or more RAM to your java runtime in the docker.

I have no idea how to control the first. For the second, change the -Xms1g and -Xmx2g in the "JAVA_OPTS" in your docker-compose.yml.
They control the starting and maximum memory for Java.
Building nord-ovest-latest.osm.pbf, I’d recommend at least -Xmx4g, and you might as well set -Xms4g as well.

Best regards

Thanks a lot.
I changed setting in -compose.yml with BUILD_GRAPHS=True and "JAVA_OPTS=-Djava.awt.headless=true -server -XX:TargetSurvivorRatio=75 -XX:SurvivorRatio=64 -XX:MaxTenuringThreshold=3 -XX:+UseG1GC -XX:+ScavengeBeforeFullGC -XX:ParallelGCThreads=4 -Xms4g -Xmx4g" but I still have this log:

2022-11-23 12:23:35,862 INFO [ors.Application] - Starting Application v6.8.0 on 33002a42b593 with PID 8 (/usr/local/tomcat/webapps/ors/WEB-INF/classes started by root in /ors-core)
2022-11-23 12:23:35,873 DEBUG [ors.Application] - Running with Spring Boot v2.3.5.RELEASE, Spring v5.2.10.RELEASE
2022-11-23 12:23:35,875 INFO [ors.Application] - No active profile set, falling back to default profiles: default
2022-11-23 12:23:38,413 INFO [ors.Application] - Started Application in 3.394 seconds (JVM running for 8.48)
2022-11-23 12:23:38,456 INFO [routing.RoutingProfileManager] -  Total - 1.00 GB, Free - 678.94 MB, Max: 2 GB, Used - 347.06 MB
2022-11-23 12:23:38,458 INFO [routing.RoutingProfileManager] -       
2022-11-23 12:23:38,483 INFO [routing.RoutingProfileManager] - ====> Initializing profiles from 'data/osm_file.pbf' (1 threads) ...
2022-11-23 12:23:38,484 INFO [routing.RoutingProfileManager] -                               
2022-11-23 12:23:38,486 INFO [routing.RoutingProfileManager] -                
2022-11-23 12:23:38,508 INFO [routing.RoutingProfile] - [1] Profiles: 'driving-car', location: 'data/graphs/car'.
2022-11-23 12:23:43,271 INFO [routing.RoutingProfile] - [1] FlagEncoders: 1, bits used [UNKNOWN]/64.
2022-11-23 12:23:43,272 INFO [routing.RoutingProfile] - [1] Capacity: [UNKNOWN]. (edges - 1711901, nodes - 1334170)
2022-11-23 12:23:43,273 INFO [routing.RoutingProfile] - [1] Total time: 4.764s.
2022-11-23 12:23:43,273 INFO [routing.RoutingProfile] - [1] Finished at: 2022-11-23 12:23:43.
2022-11-23 12:23:43,273 INFO [routing.RoutingProfile] -                               
2022-11-23 12:23:43,276 INFO [routing.RoutingProfile] - [2] Profiles: 'foot-walking', location: 'data/graphs/walking'.
2022-11-23 12:25:50,887 ERROR [routing.RoutingProfileManager] - java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
2022-11-23 12:25:50,888 ERROR [routing.RoutingProfileManager] - Failed to initialize RoutingProfileManager instance.
java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
	at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:?]
	at java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[?:?]
	at org.heigit.ors.routing.RoutingProfileManager.initialize(RoutingProfileManager.java:178) ~[classes/:6.8.0]
	at org.heigit.ors.routing.RoutingProfileManager.getInstance(RoutingProfileManager.java:72) ~[classes/:6.8.0]
	at org.heigit.ors.servlet.listeners.ORSInitContextListener.lambda$contextInitialized$0(ORSInitContextListener.java:41) ~[classes/:6.8.0]
	at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
	at com.graphhopper.routing.lm.LMAlgoFactoryDecorator.loadOrDoWork(LMAlgoFactoryDecorator.java:303) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.GraphHopper.loadOrPrepareLM(GraphHopper.java:1396) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.GraphHopper.postProcessing(GraphHopper.java:954) ~[graphhopper-core-v0.13.23.jar:?]
	at org.heigit.ors.routing.graphhopper.extensions.ORSGraphHopper.postProcessing(ORSGraphHopper.java:682) ~[classes/:6.8.0]
	at com.graphhopper.GraphHopper.process(GraphHopper.java:703) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:680) ~[graphhopper-core-v0.13.23.jar:?]
	at org.heigit.ors.routing.graphhopper.extensions.ORSGraphHopper.importOrLoad(ORSGraphHopper.java:169) ~[classes/:6.8.0]
	at org.heigit.ors.routing.RoutingProfile.initGraphHopper(RoutingProfile.java:184) ~[classes/:6.8.0]
	at org.heigit.ors.routing.RoutingProfile.<init>(RoutingProfile.java:128) ~[classes/:6.8.0]
	at org.heigit.ors.routing.RoutingProfileLoader.call(RoutingProfileLoader.java:35) ~[classes/:6.8.0]
	at org.heigit.ors.routing.RoutingProfileLoader.call(RoutingProfileLoader.java:21) ~[classes/:6.8.0]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
	... 1 more
Caused by: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
	at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:?]
	at java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[?:?]
	at com.graphhopper.routing.lm.LMAlgoFactoryDecorator.loadOrDoWork(LMAlgoFactoryDecorator.java:299) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.GraphHopper.loadOrPrepareLM(GraphHopper.java:1396) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.GraphHopper.postProcessing(GraphHopper.java:954) ~[graphhopper-core-v0.13.23.jar:?]
	at org.heigit.ors.routing.graphhopper.extensions.ORSGraphHopper.postProcessing(ORSGraphHopper.java:682) ~[classes/:6.8.0]
	at com.graphhopper.GraphHopper.process(GraphHopper.java:703) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:680) ~[graphhopper-core-v0.13.23.jar:?]
	at org.heigit.ors.routing.graphhopper.extensions.ORSGraphHopper.importOrLoad(ORSGraphHopper.java:169) ~[classes/:6.8.0]
	at org.heigit.ors.routing.RoutingProfile.initGraphHopper(RoutingProfile.java:184) ~[classes/:6.8.0]
	at org.heigit.ors.routing.RoutingProfile.<init>(RoutingProfile.java:128) ~[classes/:6.8.0]
	at org.heigit.ors.routing.RoutingProfileLoader.call(RoutingProfileLoader.java:35) ~[classes/:6.8.0]
	at org.heigit.ors.routing.RoutingProfileLoader.call(RoutingProfileLoader.java:21) ~[classes/:6.8.0]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
	... 1 more
Caused by: java.lang.OutOfMemoryError: Java heap space
	at com.graphhopper.routing.subnetwork.TarjansSCCAlgorithm.<init>(TarjansSCCAlgorithm.java:58) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.routing.lm.LandmarkStorage.createLandmarks(LandmarkStorage.java:263) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.routing.lm.PrepareLandmarks.doSpecificWork(PrepareLandmarks.java:130) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.routing.util.AbstractAlgoPreparation.doWork(AbstractAlgoPreparation.java:30) ~[graphhopper-core-v0.13.23.jar:?]
	at com.graphhopper.routing.lm.LMAlgoFactoryDecorator$1.run(LMAlgoFactoryDecorator.java:289) ~[graphhopper-core-v0.13.23.jar:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
	... 1 more
2022-11-23 12:25:50,897 INFO [routing.RoutingProfileManager] - ====> Recycling garbage...
2022-11-23 12:25:50,898 INFO [routing.RoutingProfileManager] - Before:  Total - 2 GB, Free - 104.07 MB, Max: 2 GB, Used - 1.90 GB
2022-11-23 12:25:50,948 INFO [routing.RoutingProfileManager] - After:  Total - 2 GB, Free - 1.08 GB, Max: 2 GB, Used - 944.70 MB
2022-11-23 12:25:50,949 INFO [routing.RoutingProfileManager] - ========================================================================
2022-11-23 12:25:50,949 INFO [routing.RoutingProfileManager] - ====> Memory usage by profiles:
2022-11-23 12:25:50,952 INFO [routing.RoutingProfileManager] - [1] 376.03 MB (39.8%)
2022-11-23 12:25:50,953 INFO [routing.RoutingProfileManager] - Total: 376.03 MB (39.8%)
2022-11-23 12:25:50,953 INFO [routing.RoutingProfileManager] - ========================================================================
2022-11-23 12:25:51,177 INFO [util.SystemMessage] - SystemMessage loaded 0 messages.

So, if I understood, I have to find a way to allocate more RAM for my docker instance. I am using Docker Desktop and no VM and it seems that I have to change my .wslconfig.

Thanks

1 Like

Hi again, I have solved the problem so I think it can be good to describe everything here in case of similar questions.

I followed the instruction of this video to Setup a Self-Hosted OpenRouteService Instance with Docker on Windows. My aim was to have another pbf (in Italy) and the possibility to use ORS for car and foot-walking.

After have modified ors.config, docker-compose and changed ./conf:/ors-conf in ./conf:/ors-conf:ro I got stucked due to a JAVA error that basically said Docker instance or the java runtime had not enough RAM.

For the first I changed in docker-compose.yml the JAVA_OPTS from -Xms1g and -Xmx2g to -Xms4g and -Xmx4g, allocating more RAM, but it was not working.

So, I found out how to allocate more RAM to my Docker: this was made creating in %USERPROFILE% a file .wslconfig. Fill this file with what you find in this post and just pay attention to have WSL2 correctly installed and a Linux Kernel (I used Ubuntu). In line 8 add the correct path for your Kernel: kernel=C:\\temp\\myCustomKernel.

After that, everything should run correctly, also in QGIS if you configure well the local server in ORS Tools plugin.

Edit: maybe if everything works ca be a good idea to turn False the BUILD_GRAPHS parameter in docker-compose.

Thanks again @jschnell.

1 Like