Skip to content

negative values in distances matrix (v5.22.0) #5855

@cyril23

Description

@cyril23

Background

This problem exists both in official OSRM server router.project-osrm.org, and I can find it in my own setup, too.

Here about my own setup:

  • I am using docker version https://hub.docker.com/r/osrm/osrm-backend/tags/ osrm-backend:v5.22.0

  • I start the docker like this: docker run --label osrm_install_path=osrm_ch_bicycle_1 -p 5001:5001 -v /root/osrm_ch_bicycle_1:/data osrm/osrm-backend:v5.22.0 osrm-routed --algorithm ch --max-trip-size=2000 --max-table-size=2000 --max-viaroute-size=2000 /data/dach-latest.osm.pbf

  • So I've used the dach-latest.osm.pbf from download.geofabrik.de, see logging:

    2020-10-03 23:02:22 URL:https://download.geofabrik.de/europe/dach-latest.osm.pbf [4421864964/4421864964] -> "dach-latest.osm.pbf" [1]

  • Preprocessing was done via /opt/bicycle.lua and CH pipeline:

    • Extraction: docker run --label osrm_install_path=/root/osrm_ch_bicycle_1/ -t -v /root/osrm_ch_bicycle_1/:/data -v osrm/osrm-backend:v5.22.0 osrm-extract -p /opt/bicycle.lua /data/dach-latest.osm.pbf
    • Logs extraction: preprocessing_02_extract.log
    • Contraction: docker run --label osrm_install_path=/root/osrm_ch_bicycle_1/ -t -v /root/osrm_ch_bicycle_1/:/data osrm/osrm-backend:v5.22.0 osrm-contract /data/dach-latest.osm.pbf
    • Logs contraction: preprocessing_03_contract.log
    • I still have the files here:
      image
  • I run this without any problems in 99,9% cases for /route/ and /table/ requests.

  • But about 1 in 1000 requests, I get negative values in OSRM distance matrices. This is deterministic, I mean the same requests return the same responses of course. But the negative values don't happen often, because my clients don't make such problematic requests often.

Example (bicycle profile)

  • On Port 5001, the /opt/bicycle.lua server is running. Therefore, don't be confused because of the /car/ here.
curl "http://127.0.0.1:5001/table/v1/car/6.917325,50.949002;6.89497,51.02085;6.903292,51.025422;7.004522,50.961342;7.004607,50.956687;7.08369,50.91637;7.050799,50.925633;7.002814,50.935468;6.97731,50.928274;6.97683,50.93066;6.964476,50.925211;6.964188,50.919921;6.95637,50.91763;6.950404,50.93562;6.950244,50.940655;6.911978,50.937178;6.90561,50.941806;6.917325,50.949001;6.917325,50.949002;6.917325,50.949001?annotations=duration,distance" > neg1.txt && grep -o -P -- ".{0,15}-\d+?.{0,15}" neg1.txt

image
image
neg1.txt

From this, I made a minimum example with just 2 points:

curl "http://127.0.0.1:5001/table/v1/car/6.917325,50.949002;6.917325,50.949001?annotations=duration,distance"
{"code":"Ok","sources":[{"hint":"ixYAgDz6CoCbAAAAnAAAAAAAAAAAAAAAnrqBQgnpgUIAAAAAAAAAAJsAAACcAAAAAAAAAAAAAAAlAQAAVIxpAMBrCQPNjGkAimsJAwAAfw3_2y9V","distance":10.415011,"name":"Sömmeringstraße","location":[6.917204,50.949056]},{"hint":"ixYAgDz6CoCbAAAAnAAAAAAAAAAAAAAACemBQp66gUIAAAAAAAAAAJsAAACcAAAAAAAAAAAAAAAlAQAAVIxpAL9rCQPNjGkAiWsJAwAAfw3_2y9V","distance":10.415011,"name":"Sömmeringstraße","location":[6.917204,50.949055]}],"destinations":[{"hint":"ixYAgDz6CoCbAAAAnAAAAAAAAAAAAAAAnrqBQgnpgUIAAAAAAAAAAJsAAACcAAAAAAAAAAAAAAAlAQAAVIxpAMBrCQPNjGkAimsJAwAAfw3_2y9V","distance":10.415011,"name":"Sömmeringstraße","location":[6.917204,50.949056]},{"hint":"ixYAgDz6CoCbAAAAnAAAAAAAAAAAAAAACemBQp66gUIAAAAAAAAAAJsAAACcAAAAAAAAAAAAAAAlAQAAVIxpAL9rCQPNjGkAiWsJAwAAfw3_2y9V","distance":10.415011,"name":"Sömmeringstraße","location":[6.917204,50.949055]}],"durations":[[0,0],[0,0]],"distances":[[0,-0.1],[0.1,0]]}

See: "durations":[[0,0],[0,0]],"distances":[[0,-0.1],[0.1,0]]
edit: fixed minimum example

  • edit: on car profile this example returns "durations":[[0,0.1],[88.8,0]],"distances":[[0,0.1],[653.6,0]], maybe because the car is driving a circle:
curl "http://127.0.0.1:5000/table/v1/car/6.917325,50.949002;6.917325,50.949001?annotations=duration,distance"
{"code":"Ok","sources":[{"hint":"RisBgP___39gAAAAwgAAAAAAAAAAAAAAnrqBQgnpgUIAAAAAAAAAAGAAAADCAAAAAAAAAAAAAAALlwAAVIxpAMBrCQPNjGkAimsJAwAAfw3tuiYy","distance":10.415011,"name":"Sömmeringstraße","location":[6.917204,50.949056]},{"hint":"RisBgP___39hAAAAwgAAAAAAAAAAAAAACemBQp66gUIAAAAAAAAAAGEAAADCAAAAAAAAAAAAAAALlwAAVIxpAL9rCQPNjGkAiWsJAwAAfw3tuiYy","distance":10.415011,"name":"Sömmeringstraße","location":[6.917204,50.949055]}],"destinations":[{"hint":"RisBgP___39gAAAAwgAAAAAAAAAAAAAAnrqBQgnpgUIAAAAAAAAAAGAAAADCAAAAAAAAAAAAAAALlwAAVIxpAMBrCQPNjGkAimsJAwAAfw3tuiYy","distance":10.415011,"name":"Sömmeringstraße","location":[6.917204,50.949056]},{"hint":"RisBgP___39hAAAAwgAAAAAAAAAAAAAACemBQp66gUIAAAAAAAAAAGEAAADCAAAAAAAAAAAAAAALlwAAVIxpAL9rCQPNjGkAiWsJAwAAfw3tuiYy","distance":10.415011,"name":"Sömmeringstraße","location":[6.917204,50.949055]}],"durations":[[0,0.1],[88.8,0]],"distances":[[0,0.1],[653.6,0]]}

Another Example (car profile)

  • I did the CH pipeline for the car profile, too; on Port 5000, the /opt/car.lua server is running.
  • This issue seems to be independent from the profile in use; it may happen in both profiles
curl "http://127.0.0.1:5000/table/v1/car/7.210353,51.265175;7.210353,51.265178;7.206108,51.227533;7.20133,51.25279;7.1603,51.24005;7.15322,51.23908;7.123063,51.191963;7.13323,51.25664;7.216901,51.231529;7.21006,51.264117;7.096997,51.256183;7.1582,51.23588;7.134593,51.25603;7.210353,51.265175?annotations=duration,distance" | grep -o -P -- ".{0,15}-\d+?.{0,15}"

image
neg-car.txt

Minimum example:

curl "http://127.0.0.1:5000/table/v1/car/7.210353,51.265175;7.210353,51.265178?annotations=duration,distance"
# the output:
{"code":"Ok","sources":[{"hint":"5pM2g2f-U4QJAAAA1AAAAA0AAAAGAAAAJyHQQIMsE0O_MQ1B7WKIQAkAAADUAAAADQAAAAYAAAALlwAA0AVuAD0-DgNxBW4Alz4OAwEAjwPtuiYy","distance":12.008651,"name":"Lönsstraße","location":[7.210448,51.265085]},{"hint":"5pM2g2f-U4QJAAAA1AAAAA0AAAAGAAAADdHVQAP_EkO_MQ1B7WKIQAkAAADUAAAADQAAAAYAAAALlwAA0gVuAD4-DgNxBW4Amj4OAwEAjwPtuiYy","distance":12.271231,"name":"Lönsstraße","location":[7.21045,51.265086]}],"destinations":[{"hint":"5pM2g2f-U4QJAAAA1AAAAA0AAAAGAAAAJyHQQIMsE0O_MQ1B7WKIQAkAAADUAAAADQAAAAYAAAALlwAA0AVuAD0-DgNxBW4Alz4OAwEAjwPtuiYy","distance":12.008651,"name":"Lönsstraße","location":[7.210448,51.265085]},{"hint":"5pM2g2f-U4QJAAAA1AAAAA0AAAAGAAAADdHVQAP_EkO_MQ1B7WKIQAkAAADUAAAADQAAAAYAAAALlwAA0gVuAD4-DgNxBW4Amj4OAwEAjwPtuiYy","distance":12.271231,"name":"Lönsstraße","location":[7.21045,51.265086]}],"durations":[[0,0],[0,0]],"distances":[[0,-0.2],[0.2,0]]}

See: "durations":[[0,0],[0,0]],"distances":[[0,-0.2],[0.2,0]]

Same when using the current OSRM demo server:

curl "http://router.project-osrm.org/table/v1/car/7.210353,51.265175;7.210353,51.265178?annotations=duration,distance"
{"code":"Ok","distances":[[0,-0.2],[0.2,0]],"durations":[[0,0],[0,0]],"sources":[{"hint":"msmVkL7JlZAJAAAA1AAAAA0AAAAGAAAAJyHQQIMsE0O_MQ1BvzENQQkAAADUAAAADQAAAAYAAABoHgEA0AVuAD0-DgNxBW4Alz4OAwEAjwPis2Jc","location":[7.210448,51.265085],"name":"Lönsstraße"},{"hint":"msmVkL7JlZAJAAAA1AAAAA0AAAAGAAAADdHVQAP_EkO_MQ1BvzENQQkAAADUAAAADQAAAAYAAABoHgEA0gVuAD4-DgNxBW4Amj4OAwEAjwPis2Jc","location":[7.21045,51.265086],"name":"Lönsstraße"}],"destinations":[{"hint":"msmVkL7JlZAJAAAA1AAAAA0AAAAGAAAAJyHQQIMsE0O_MQ1BvzENQQkAAADUAAAADQAAAAYAAABoHgEA0AVuAD0-DgNxBW4Alz4OAwEAjwPis2Jc","location":[7.210448,51.265085],"name":"Lönsstraße"},{"hint":"msmVkL7JlZAJAAAA1AAAAA0AAAAGAAAADdHVQAP_EkO_MQ1BvzENQQkAAADUAAAADQAAAAYAAABoHgEA0gVuAD4-DgNxBW4Amj4OAwEAjwPis2Jc","location":[7.21045,51.265086],"name":"Lönsstraße"}]}

related issues

#5306 seems to be related (maybe its fix doesn't work here?)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions