osrm-profiles-contrib icon indicating copy to clipboard operation
osrm-profiles-contrib copied to clipboard

Extraction aborts on unsanitized data

Open rebos opened this issue 4 years ago • 0 comments

Running osrm-extract with the truck-soft profile and the associated scripts from the lib directory (v5.21), I stumbled over errors concerning unsanitized input data. Unfortunately the extract process aborted.

The first error was this one: what(): lua: error: /opt/truck_soft.lua:353: attempt to compare string with number

I was able to cirumvent this by adding a call to the function tonumber().

The next one was this one: what(): lua: error: /opt/lib/way_handlers.lua:483: attempt to compare string with number

Trying to apply the same fix by calling tonumber() led to this error message: what(): lua: error: /opt/lib/way_handlers.lua:483: attempt to compare nil with number

Data seams to be involved, that cannot be converted to a number. So to make the conversion more robust, I decided to add a check: First try to convert the data to a number and only if this works (result is not nil) then use that converted data. By the way: I am using data provided by Geofabrik consisting of OpenStreetMap data for the sub region Europe and osrm-backend v5.24.0 from Docker Hub.

I will create a PR so someone can examine my workaround. Calling tonumber() twice within one statement may not be the smartest solution. But it works for me and I cannot observe any regression concerning the duration of the extract process.

Thanks and greetings, rebos

rebos avatar Apr 14 '21 10:04 rebos