Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Unreleased
- Changes from 6.0.0
- Routing:
- FIXED: Prevent MLD route queries from updating removed heap nodes, avoiding `osrm-routed` segfaults/asserts [#7203](https://github.com/Project-OSRM/osrm-backend/issues/7203)
- FIXED: Crash when route starts or ends at `type=manoeuvre` relation via node [#7287](https://github.com/Project-OSRM/osrm-backend/issues/7287)
- Extraction:
- ADDED: Emit warning when ways reference nodes not present in input data [#1596](https://github.com/Project-OSRM/osrm-backend/issues/1596)
Expand Down
2 changes: 1 addition & 1 deletion include/engine/routing_algorithms/routing_base_mld.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ void insertOrUpdate(Heap &heap,
{
heap.Insert(node, weight, data);
}
else if (weight < heapNode->weight)
else if (!heapNode->WasRemoved() && weight < heapNode->weight)
{
heapNode->data = data;
heapNode->weight = weight;
Expand Down
2 changes: 2 additions & 0 deletions include/util/query_heap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ class QueryHeap
NodeID node;
Weight weight;
Data data;

bool WasRemoved() const { return handle == HeapContainer::INVALID_HANDLE; }
};

template <typename... StorageArgs> explicit QueryHeap(StorageArgs... args) : node_index(args...)
Expand Down
24 changes: 24 additions & 0 deletions unit_tests/engine/offline_facade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,4 +398,28 @@ BOOST_AUTO_TEST_CASE(facade_uncompressed_methods)
BOOST_CHECK_EQUAL(facade.GetUncompressedReverseDatasources(0).size(), 0);
}

BOOST_AUTO_TEST_CASE(insert_or_update_skips_removed_nodes)
{
using QueryHeap = osrm::engine::SearchEngineData<
osrm::engine::routing_algorithms::offline::Algorithm>::QueryHeap;

QueryHeap heap(4, 0);
const osrm::engine::MultiLayerDijkstraHeapData initial_data{SPECIAL_NODEID, false};
const osrm::engine::MultiLayerDijkstraHeapData updated_data{1, true};

heap.Insert(1, {10}, initial_data);
BOOST_CHECK_EQUAL(heap.DeleteMin(), 1);
BOOST_CHECK(heap.WasRemoved(1));

osrm::engine::routing_algorithms::mld::insertOrUpdate(heap, 1, {5}, updated_data);

BOOST_CHECK(heap.WasRemoved(1));
BOOST_CHECK_EQUAL(from_alias<int>(heap.GetKey(1)), 10);

const auto heap_node = heap.GetHeapNodeIfWasInserted(1);
BOOST_REQUIRE(heap_node != nullptr);
BOOST_CHECK_EQUAL(heap_node->data.parent, SPECIAL_NODEID);
BOOST_CHECK_EQUAL(heap_node->data.from_clique_arc, false);
}

BOOST_AUTO_TEST_SUITE_END()
Loading