Limit reached way too fast: "Search exceeds the limit of visited nodes."

Hello ORS-Team,
hello community,

my name is Stephan, I am new to the community.
I have seen some related topics, but none had a detailed description nor any solution.

I started to play around with a self hosted ors instance in docker and I am under the impression that I run into this error way too fast.

{'error': {'code': 6020, 'message': 'Unable to compute a distance/duration matrix: Search exceeds the limit of visited nodes.'}, 'info': {'engine': {'build_date': '2025-11-14T08:09:49Z', 'graph_version': '3', 'graph_date': '2025-12-12T08:39:37Z', 'osm_date': '2025-12-08T21:20:45Z', 'version': '9.5.1'}, 'timestamp': 1765660360820}}

It appears when trying to calculate a 12x12 matrix (10x10 is fine) of random points in the following bounds:

MIN_LAT, MAX_LAT = 51, 51.10
MIN_LON, MAX_LON = 10, 10.10

This is my my-ors-config.yml:

Summary
ors:
  engine:
    init_threads: 10
    graphs_data_access: RAM_STORE
    profile_default:
      enabled: false
      build:
        source_file: /home/ors/files/europe-latest.osm.pbf
        elevation: false
      service:
        maximum_distance: 1000000  # 1.000 km
        maximum_waypoints: 50
        maximum_snapping_radius: 1000  # 1 km
        maximum_visited_nodes: 100000000  # 100.000.000

    profiles:
      driving-hgv:
        enabled: true
        build:
          encoder_options:
            turn_costs: true
            block_fords: true
            use_acceleration: true
          preparation:
            min_network_size: 200
            methods:
              lm:
                enabled: true
                threads: 10
                weightings: recommended
                landmarks: 16
              ch:
                enabled: false
        service:
          maximum_distance: ${ors.engine.profile_default.service.maximum_distance}
          maximum_snapping_radius: ${ors.engine.profile_default.service.maximum_snapping_radius}
          maximum_visited_nodes: ${ors.engine.profile_default.service.maximum_visited_nodes}

  endpoints:
    routing:
      enabled: true
    matrix:
      enabled: true
      maximum_routes: 250000
      maximum_routes_flexible: 250000

This is the full container log file:

Summary
#################
# Container ENV #
#################
✓ CONTAINER_LOG_LEVEL: INFO. Set CONTAINER_LOG_LEVEL=DEBUG for more details.
ⓘ Any config file settings can be overwritten by environment variables.
ⓘ Use 'CONTAINER_LOG_LEVEL=DEBUG' to see the full list of active environment variables for this container.
###########################
# Container sanity checks #
###########################
ⓘ Running container as user root with id 0 and group 0
✓ ORS_HOME: /home/ors exists and is writable.
✓ The file /home/ors/config/example-ors-config.env is up to date
✓ The file /home/ors/config/example-ors-config.yml is up to date
✓ Using yml config from ENV: /home/ors/config/my-ors-config.yml
ⓘ Default to graphs folder: /home/ors/graphs
ⓘ Any ENV variables will have precedence over configuration variables from config files.
✓ All checks passed. For details set CONTAINER_LOG_LEVEL=DEBUG.
#####################################
# Container file system preparation #
#####################################
✓ The file /home/ors/files/example-heidelberg.test.pbf is up to date
✓ Container file system preparation complete. For details set CONTAINER_LOG_LEVEL=DEBUG.
#######################################
# Prepare CATALINA_OPTS and JAVA_OPTS #
#######################################
✓ CATALINA_OPTS and JAVA_OPTS ready. For details set CONTAINER_LOG_LEVEL=DEBUG.
#####################
# ORS startup phase #
#####################
✓ 🙭 Ready to start the ORS application 🙭

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                (v3.5.7)

2025-12-13 21:11:58 INFO                                                  main [ o.h.o.a.Application                      ]   Starting Application v9.5.1 using Java 21.0.9 with PID 1 (/ors.jar started by root in /home/ors)
2025-12-13 21:11:58 INFO                                                  main [ o.h.o.a.Application                      ]   The following 1 profile is active: "default"
2025-12-13 21:11:58 INFO                                                  main [ o.h.o.a.ORSEnvironmentPostProcessor      ]
2025-12-13 21:11:58 INFO                                                  main [ o.h.o.a.ORSEnvironmentPostProcessor      ]   Configuration lookup started.
2025-12-13 21:11:58 INFO                                                  main [ o.h.o.a.ORSEnvironmentPostProcessor      ]   ORS config file found at: /home/ors/config/my-ors-config.yml
2025-12-13 21:11:58 INFO                                                  main [ o.h.o.a.ORSEnvironmentPostProcessor      ]   Configuration file set by environment variable.
2025-12-13 21:11:58 INFO                                                  main [ o.h.o.a.ORSEnvironmentPostProcessor      ]   Loaded file '/home/ors/config/my-ors-config.yml'.
2025-12-13 21:11:58 INFO                                                  main [ o.h.o.a.ORSEnvironmentPostProcessor      ]
2025-12-13 21:11:58 INFO                                                  main [ o.h.o.a.ORSEnvironmentPostProcessor      ]   Environment variables overriding openrouteservice configuration parameters detected:
2025-12-13 21:11:58 INFO                                                  main [ o.h.o.a.ORSEnvironmentPostProcessor      ]   ors.config.location=/home/ors/config/my-ors-config.yml
2025-12-13 21:11:58 INFO                                                  main [ o.h.o.a.ORSEnvironmentPostProcessor      ]   Configuration lookup finished.
2025-12-13 21:11:58 INFO                                                  main [ o.h.o.a.ORSEnvironmentPostProcessor      ]
2025-12-13 21:11:59 INFO                                              ORS-Init [ o.h.o.a.s.l.ORSInitContextListener       ]   Initializing ORS...
2025-12-13 21:11:59 INFO                                              ORS-Init [ o.h.o.r.RoutingProfileManager            ]   Total - 8 GB, Free - 7.91 GB, Max: 96 GB, Used - 91.55 MB
2025-12-13 21:11:59 INFO                                              ORS-Init [ o.h.o.r.RoutingProfileManager            ]   ====> Initializing 1 profiles (10 threads) ...
2025-12-13 21:11:59 INFO                                              ORS-Init [ o.h.o.r.RoutingProfileManager            ]   1 profile configurations submitted as tasks.
2025-12-13 21:12:00 WARN                                    ORS-pl-driving-hgv [ o.h.o.r.g.e.ORSGraphHopperConfig         ]   Elevation is set to false.
2025-12-13 21:12:00 WARN                                    ORS-pl-driving-hgv [ o.h.o.r.g.e.ORSGraphHopperConfig         ]   Elevation deactivated.
2025-12-13 21:12:00 INFO                                    ORS-pl-driving-hgv [ o.h.o.r.g.e.c.CorePreparationHandler     ]   Using 1 threads for ch preparation threads
2025-12-13 21:12:00 INFO                                    ORS-pl-driving-hgv [ o.h.o.r.g.e.c.CoreLMPreparationHandler   ]   Using 1 threads for lm preparation threads
2025-12-13 21:12:00 INFO                                    ORS-pl-driving-hgv [ o.h.o.r.g.e.c.CorePreparationHandler     ]   Using 1 threads for ch preparation threads
2025-12-13 21:12:00 INFO                                    ORS-pl-driving-hgv [ o.h.o.r.g.e.c.CoreLMPreparationHandler   ]   Using 1 threads for lm preparation threads
2025-12-13 21:12:00 INFO                                    ORS-pl-driving-hgv [ o.h.o.r.g.e.c.CoreLMPreparationHandler   ]   Loaded landmark splitting collection from
2025-12-13 21:12:00 INFO                                                  main [ o.h.o.a.Application                      ]   Started Application in 2.654 seconds (process running for 3.566)
2025-12-13 21:12:00 INFO                                                  main [ o.h.o.a.Application                      ]   openrouteservice {"build_date":"2025-11-14T08:09:49Z","graph_version":"3","version":"9.5.1"}
2025-12-13 21:12:18 INFO                                    ORS-pl-driving-hgv [ o.h.o.r.g.e.c.CorePreparationHandler     ]   Creating CH preparations, totalMB:51456, usedMB:22621
2025-12-13 21:12:18 INFO                                    ORS-pl-driving-hgv [ o.h.o.r.g.e.c.CoreLMPreparationHandler   ]   Creating LM preparations, totalMB:51456, usedMB:22625
2025-12-13 21:12:23 INFO                                    ORS-pl-driving-hgv [ o.h.o.r.g.e.c.CoreLMPreparationHandler   ]   Finished LM preparation, totalMB:60832, usedMB:28739
2025-12-13 21:12:23 INFO                                    ORS-pl-driving-hgv [ o.h.o.r.g.e.ORSGraphHopper               ]   version v4.11.0|2025-11-13T15:32:49Z (7,20,5,4,5,7)
2025-12-13 21:12:23 INFO                                    ORS-pl-driving-hgv [ o.h.o.r.g.e.ORSGraphHopper               ]   graph heavyvehicle|RAM_STORE|2D|turn_cost|7,20,5,4,5, details:edges:107 875 646(3704MB), nodes:91 436 585(1396MB), name:(364MB), geo:564 921 311(2156MB), bounds:-31.2664814,48.7909105,28.1413727,78.972536, shortcuts:80 944 750 (2 471MB), nodesCH:91 436 585 (698MB), shortcuts:93 093 860 (2 841MB), nodesCH:91 436 585 (698MB)
2025-12-13 21:12:23 INFO                                    ORS-pl-driving-hgv [ o.h.o.r.RoutingProfile                   ]   [1] Profile: 'driving-hgv', encoder: 'driving-hgv', location: 'graphs/driving-hgv'.
2025-12-13 21:12:23 INFO                                    ORS-pl-driving-hgv [ o.h.o.r.RoutingProfile                   ]   [1] Edges: 107875646 - Nodes: 91436585.
2025-12-13 21:12:23 INFO                                    ORS-pl-driving-hgv [ o.h.o.r.RoutingProfile                   ]   [1] Total time: 22.989s.
2025-12-13 21:12:23 INFO                                    ORS-pl-driving-hgv [ o.h.o.r.RoutingProfile                   ]   [1] Finished at: 2025-12-13 21:12:23.
2025-12-13 21:12:23 INFO                                              ORS-Init [ o.h.o.r.RoutingProfileManager            ]   Total time: 23.133s.
2025-12-13 21:12:23 INFO                                              ORS-Init [ o.h.o.r.RoutingProfileManager            ]   ========================================================================
2025-12-13 21:12:23 INFO                                              ORS-Init [ o.h.o.r.RoutingProfileManager            ]   ====> Recycling garbage...
2025-12-13 21:12:23 INFO                                              ORS-Init [ o.h.o.r.RoutingProfileManager            ]   Before: Total - 59.41 GB, Free - 31.32 GB, Max: 96 GB, Used - 28.09 GB
2025-12-13 21:12:23 INFO                                              ORS-Init [ o.h.o.r.RoutingProfileManager            ]   After: Total - 59.41 GB, Free - 31.35 GB, Max: 96 GB, Used - 28.06 GB
2025-12-13 21:12:23 INFO                                              ORS-Init [ o.h.o.r.RoutingProfileManager            ]   ========================================================================
2025-12-13 21:12:23 INFO                                              ORS-Init [ o.h.o.r.RoutingProfileManager            ]   ====> Memory usage by profiles:
2025-12-13 21:12:23 INFO                                              ORS-Init [ o.h.o.r.RoutingProfileManager            ]   [1] 25.17 GB (89.7%)
2025-12-13 21:12:23 INFO                                              ORS-Init [ o.h.o.r.RoutingProfileManager            ]   Total: 25.17 GB (89.7%)
2025-12-13 21:12:23 INFO                                              ORS-Init [ o.h.o.r.RoutingProfileManager            ]   ========================================================================

The pbf file is the current europe-latest from GeoFabrik.

I am running a second server with the same config except germany-latest as the pbf file. On the second server those matrix calculations are running smoothly.

As a try & error approach includes building a new graph each time, I would like to know if you have any idea what I need to do, to increase the matrix capabilities?

Best,
Stephan

Found the issue:

The matrix endpoint needs its own value of maximum_visited_nodes.

1 Like