Project-OSRM / osrm-backend

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

osrm-extract command with run-time error on Windows OS #6941

Open tommybee-dev opened 3 weeks ago

tommybee-dev commented 3 weeks ago

Discussed in https://github.com/Project-OSRM/osrm-backend/discussions/6932

Originally posted by **tommybee-dev** June 8, 2024 Hi, I am new to OSM back-end. Recently I've built this project with MSVC 2022 Express. I've downloaded a pb file frome [here](http://download.geofabrik.de/asia/south-korea-latest.osm.pbf). I've got a runtime error at near by 'next' function since running osrm-extract.exe with the file I downloaded. **osrm-extract** data/south-korea-latest.osm.pbf ![error0](https://github.com/Project-OSRM/osrm-backend/assets/7607807/27a6dee0-a3c4-4be7-98c0-fd61b3e2a36b) Here is what I am traced the code from file restriction_graph.cpp. ![error1](https://github.com/Project-OSRM/osrm-backend/assets/7607807/6567a357-2586-45f4-9fef-d7e68499f2ff) ![error2](https://github.com/Project-OSRM/osrm-backend/assets/7607807/d9cea4b1-ad38-4a63-9b70-831a51822559) ![error3](https://github.com/Project-OSRM/osrm-backend/assets/7607807/07ac751a-9db5-446d-ada9-7ee5b025dacf) I don't know how to handle these error. Thanks.
tommybee-dev commented 3 days ago

Hi, Finally, I found the point where the access violation from since I am trying to dig the code in the restriction_graph.cpp.

// Also add any restric
 // tions from suffix paths to the current node in the
 // restriction graph.
 for (const auto &restriction : rg.GetRestrictions(suffix_node))
 {
     insertRestriction(rg, cur_node, restriction);
 }

I changed the original code in the next function above as followed:

// Also add any restric
// tions from suffix paths to the current node in the
// restriction graph.
RestrictionGraph::RestrictionRange range1 = rg.GetRestrictions(suffix_node);

for (int i = 0; i < range1.size(); i++)
{
    const auto &restriction = range1[i];
    insertRestriction(rg, cur_node, restriction);
}

I think the problem is clear that the range has the same memory begin and end. But I still don't know why this problem gonna happened.

Anyone can get me go further will be appreciated.

Thanks.