Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tommybee-dev opened this issue Jun 11, 2024 Discussed in #6932 · 2 comments
Open

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

tommybee-dev opened this issue Jun 11, 2024 Discussed in #6932 · 2 comments

Comments

@tommybee-dev
Copy link

tommybee-dev commented Jun 11, 2024

Discussed in #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.

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

Here is what I am traced the code from file restriction_graph.cpp.

error1
error2
error3

I don't know how to handle these error.
Thanks.

@tommybee-dev
Copy link
Author

tommybee-dev commented Jul 2, 2024

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.

@mrquangbadao
Copy link

mrquangbadao commented Jul 17, 2024

Hi Mr @tommybee-dev, I am Quang, your friend here.
I applied your solution to the code snippet above and testing it using unit test (using extractor-tests.exe). It’s great news that these block code no longer has errors!
However, I noticed another error starting from line 150 in the restriction_graph.cpp file, which had the same root cause as the previous code.
I used your solution to fix this code snippet as well, modifying the code
From:

for (const auto &suffix_edge : rg.GetEdges(suffix_node)) {
    if (suffix_edge.is_transfer) {
        continue;
    }
//other code

To:

RestrictionGraph::EdgeRange suffix_edges = rg.GetEdges(suffix_node);
for (int i = 0; i < suffix_edges.size(); i++)
{
    const auto &suffix_edge = suffix_edges[i];
    if (suffix_edge.is_transfer)
        continue;
//other code

After making these changes, I re-ran the unit tests, and the error related to the vector loop no longer occurred. And of course, I also tried building and running it again, and the issue has been fixed. osrm-extract.exe ran successfully without any errors.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants