valhalla icon indicating copy to clipboard operation
valhalla copied to clipboard

Isochrone generation hangs for specific lat lon

Open anish749 opened this issue 3 years ago • 3 comments

I am trying to generate isochrones for a set of points and I encounter some cases where the valhalla stops responding.

Examples of payload used for the /isochrone endpoint (http call):

{
  "locations": [
    {
      "lat": 40.868612720356,
      "lon": -84.066352844238
    }
  ],
  "costing": "pedestrian",
  "polygons": true,
  "contours": [
    {
      "time": 10.0,
      "color": "ff0000"
    }
  ]
}
{
  "locations": [
    {
      "lat": 36.693474497941,
      "lon": -119.139518737793
    }
  ],
  "costing": "pedestrian",
  "polygons": true,
  "contours": [
    {
      "time": 10.0,
      "color": "ff0000"
    }
  ]
}
{
  "locations": [
    {
      "lat": 40.219519220276,
      "lon": -82.91072845459
    }
  ],
  "costing": "pedestrian",
  "polygons": true,
  "contours": [
    {
      "time": 10.0,
      "color": "ff0000"
    }
  ]
}

Expectation: A polygon of the isochrone is returned. Actual: No response from the server.

Other information:

  • when running the server with 1 active request only. the cpu usage of the server remains around 1000m (1vCPU is used to process 1 request, and stays at 1 vCPU)
  • cancelling the request, doesn't result in the computation stoping / the cpu usage going back down.
  • the problem remains when using pyvalhalla as well. its unlikely an issue with the server or an issue with the python bindings, since these points cause problem for both.
  • the systems works fine (as intended) for a huge majority of points that I was calculating.

I have also tried calling https://valhalla1.openstreetmap.de/isochrone twice for the point 40.219519220276 -82.91072845459 to check if my valhalla setup is working as intended, and it resulted in a timeout: The server didn't respond in time

anish749 avatar Nov 08 '22 21:11 anish749

good catch! im not sure how its getting stuck in a loop (that is the likely culprit for not returning) but one thing i see that we havent hooked up is the cancellation logic (by configured time out or client hangup). the good news is that its easy to hook up the cancellation logic. the bad news is an infinite loop :smile: we'll have to do both mitigation options in the end but we can at least get the easy one to start with! thanks very much for reporting it!

kevinkreiser avatar Nov 08 '22 21:11 kevinkreiser

https://github.com/valhalla/valhalla/blob/master/valhalla/thor/dijkstras.h#L165

kevinkreiser avatar Nov 08 '22 21:11 kevinkreiser

another, likely similar one: https://github.com/valhalla/valhalla/issues/4398.

nilsnolde avatar Nov 17 '23 16:11 nilsnolde