Project-OSRM / osrm-backend

Open Source Routing Machine - C++ backend
http://map.project-osrm.org
BSD 2-Clause "Simplified" License
6.42k stars 3.4k forks source link

Assertion makes osrm-extract fail #6373

Closed warrenwyf closed 2 years ago

warrenwyf commented 2 years ago

I encountered an interruption while executing the osrm-extract command while using Armenia's OSM data:

[assert][0x7000029eb000] /Users/runner/work/osrm-backend/osrm-backend/src/guidance/turn_lane_matcher.cpp:181
in: bool osrm::guidance::lanes::canMatchTrivially(const osrm::guidance::Intersection &, const osrm::guidance::lanes::LaneDataVector &): lane_data[lane].from != INVALID_LANEID
libc++abi: terminating
[1]    87885 abort      node_modules/osrm/lib/binding/osrm-extract  -p

The test data can be downloaded from http://download.geofabrik.de/asia/armenia-latest.osm.pbf

It looks like there may be errors in the data, but because of the assertion, osrm-extract doesn't ignore the errors and interrupts the execution.

SiarheiFedartsou commented 2 years ago

Do you build OSRM manually? We probably should have disabled asserts in Release mode 🤔

SiarheiFedartsou commented 2 years ago

Do you build OSRM manually? We probably should have disabled asserts in Release mode 🤔

I can reproduce only if I explicitly build OSRM like:

cmake -DENABLE_ASSERTIONS=ON .. && make -j8
SiarheiFedartsou commented 2 years ago

I localized the issue to this function call(after it one of TurnLaneData.from starts to be equal 255) https://github.com/Project-OSRM/osrm-backend/blob/41dda32546399f1dc12af1de41668993de44c7dc/src/guidance/turn_lane_handler.cpp#L327

We explicitly set it to 255 (i.e. what causes assert to fire) here https://github.com/Project-OSRM/osrm-backend/blob/41dda32546399f1dc12af1de41668993de44c7dc/src/guidance/turn_lane_handler.cpp#L683

and this augmentEntry function is expected to set this 255 to something else, but it doesn’t happen

https://github.com/Project-OSRM/osrm-backend/blob/41dda32546399f1dc12af1de41668993de44c7dc/src/guidance/turn_lane_handler.cpp#L684

Link to current version of armenia-latest.osm.pbf with which problem is reproducible https://drive.google.com/file/d/116GlPrZOWSFYTMjcB9BnsH31OdGg047H/view?usp=sharing

warrenwyf commented 2 years ago

Do you build OSRM manually? We probably should have disabled asserts in Release mode 🤔

No, I used the prebuilt binary from node-osrm:

https://github.com/Project-OSRM/osrm-backend/releases/download/v5.26.0/node_osrm-v5.26.0-node-v93-darwin-x64-Release.tar.gz

mjjbell commented 2 years ago

OS X release builds have assertions enabled: https://github.com/Project-OSRM/osrm-backend/blob/660cea8fcc4af14f6c231e40057df713fb311126/.github/workflows/osrm-backend.yml#L276

It's probably a historical artifact that can be removed.

mjjbell commented 2 years ago

Actually, I'm also getting assertions on the Linux release build too. Now I am confused.

warrenwyf commented 2 years ago

Actually, I'm also getting assertions on the Linux release build too. Now I am confused.

Yes, but the executable files in the docker image seems to be fine

mjjbell commented 2 years ago

This is the problematic intersection: https://www.openstreetmap.org/#map=19/40.17416/44.50071

image

It includes a road whose only possible turn has a restriction applied: https://www.openstreetmap.org/relation/14065440

image

Therefore