motis icon indicating copy to clipboard operation
motis copied to clipboard

Random expensive intermodal routing requests

Open vkrause opened this issue 6 months ago • 6 comments

Further investigation of the issue mentioned by me in #438 showed this is entirely unrelated, so adding a new ticket.

It's possible to trigger routing requests that lead to an excessive amount of intermediate routing queries (> 5000). This has been observed both with parking/ppr and valhalla.

  • https://github.com/motis-project/motis/blob/master/modules/parking/src/parking_edges.cc#L140 is hit for the car/parking case, which each call taking on average 100ms. So while not an infinite loop as initially assumed this nevertheless then is busy for about 10 minutes.
  • https://github.com/motis-project/motis/blob/master/modules/valhalla/src/valhalla.cc#L186 throws an exception for requests with more than 2500 targets. That makes the request abort but there is a substantial amount of memory (can be several GBs) consumed and not freed (but apparently cleaned up at shutdown, Heaptrack shows no leak). A couple such requests and we run out of memory.

I obviously haven't tried to reproduce on the demo instance, so this is all from testing with a local Switzerland setup (with GTFS-RT/GBFS/ParkenDD enabled, but also seems to happen without any of those). The problem seems to occur more likely the closer start and destination are together, the more intermodal start/destination modes are enabled, and the higher their range is (longer max duration or e.g. car over bike). That makes me think this might happen when the reachable areas of the first/last mile modes start to overlap, but I have nothing to back that up with.

Under those conditions it usually only needs a few tries with random locations not too close to stations/stops to trigger this.

vkrause avatar Feb 14 '24 17:02 vkrause