Skip to content

assertion failed @ QueryHeap::MinKey() #5843

@slavanap

Description

@slavanap

I've localized the issue and made the proper patch (below). The assetion only fails with alternatives=true in the query.
I'm not aware of the algorithm, thus this patch may be not exhaustive.

diff --git a/src/engine/routing_algorithms/alternative_path_mld.cpp b/src/engine/routing_algorithms/alternative_path_mld.cpp
index 7bc14e5..5fffa63 100644
--- a/src/engine/routing_algorithms/alternative_path_mld.cpp
+++ b/src/engine/routing_algorithms/alternative_path_mld.cpp
@@ -683,6 +683,9 @@ makeCandidateVias(SearchEngineData<Algorithm> &search_engine_data,
     // we're over factor * weight. We have to set the weight for routingStep to INVALID_EDGE_WEIGHT
     // so that stepping will continue even after we reached the shortest path upper bound.

+    if (forward_heap.Empty())
+        return candidate_vias;
+
     EdgeWeight forward_heap_min = forward_heap.MinKey();
     EdgeWeight reverse_heap_min = reverse_heap.MinKey();

backtrace:

[assert][140490038109952] /src/osrm-backend/include/util/query_heap.hpp:280
in: Weight osrm::util::QueryHeap<NodeID, Key, Weight, Data, IndexStorage>::MinKey() const [with NodeID = unsigned int; Key = unsigned int; Weight = int; Data = osrm::engine::MultiLayerDijkstraHeapData; IndexStorage = osrm::util::TwoLevelStorage<unsigned int, int>]: !heap.empty()
terminate called without an active exception

Thread 4 "osrm-routed" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fc662d0e700 (LWP 1548)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007fc7df6e1859 in __GI_abort () at abort.c:79
#2  0x00007fc7dfab6951 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007fc7dfac247c in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007fc7dfac24e7 in std::terminate() () from /lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x0000563eb36b396e in (anonymous namespace)::assertion_failed_msg_helper (expr=expr@entry=0x563eb3849931 "!heap.empty()", msg=msg@entry=0x563eb3846f3c "",
    function=function@entry=0x563eb3874de8 "Weight osrm::util::QueryHeap<NodeID, Key, Weight, Data, IndexStorage>::MinKey() const [with NodeID = unsigned int; Key = unsigned int; Weight = int; Data = osrm::engine::MultiLayerDijkstraHeapData; In"..., file=file@entry=0x563eb3870c58 "/src/osrm-backend/include/util/query_heap.hpp", line=line@entry=280)
    at /src/osrm-backend/src/util/assert.cpp:19
#6  0x0000563eb36b398b in boost::assertion_failed (expr=expr@entry=0x563eb3849931 "!heap.empty()",
    function=function@entry=0x563eb3874de8 "Weight osrm::util::QueryHeap<NodeID, Key, Weight, Data, IndexStorage>::MinKey() const [with NodeID = unsigned int; Key = unsigned int; Weight = int; Data = osrm::engine::MultiLayerDijkstraHeapData; In"..., file=file@entry=0x563eb3870c58 "/src/osrm-backend/include/util/query_heap.hpp", line=line@entry=280)
    at /src/osrm-backend/src/util/assert.cpp:28
#7  0x0000563eb37e5c79 in osrm::util::QueryHeap<unsigned int, unsigned int, int, osrm::engine::MultiLayerDijkstraHeapData, osrm::util::TwoLevelStorage<unsigned int, int, osrm::util::UnorderedMapStorage, osrm::util::ArrayStorage> >::MinKey (this=this@entry=0x7fc6580038f0) at /src/osrm-backend/include/util/query_heap.hpp:278
#8  0x0000563eb37eddf2 in osrm::engine::routing_algorithms::(anonymous namespace)::makeCandidateVias (search_engine_data=..., facade=..., phantom_node_pair=..., parameters=...)
    at /src/osrm-backend/src/engine/routing_algorithms/alternative_path_mld.cpp:686
#9  0x0000563eb37efd98 in osrm::engine::routing_algorithms::alternativePathSearch (search_engine_data=..., facade=..., phantom_node_pair=...,
    number_of_alternatives=number_of_alternatives@entry=1) at /src/osrm-backend/src/engine/routing_algorithms/alternative_path_mld.cpp:796
#10 0x0000563eb3765d1f in osrm::engine::RoutingAlgorithms<osrm::engine::routing_algorithms::mld::Algorithm>::AlternativePathSearch (this=this@entry=0x7fc662d0caa0, phantom_node_pair=...,
    number_of_alternatives=number_of_alternatives@entry=1) at /src/osrm-backend/include/engine/routing_algorithms.hpp:154
#11 0x0000563eb37cf243 in osrm::engine::plugins::ViaRoutePlugin::HandleRequest (this=this@entry=0x563eb55824f4, algorithms=..., route_parameters=..., result=...)
    at /src/osrm-backend/src/engine/plugins/viaroute.cpp:124
#12 0x0000563eb3764e63 in osrm::engine::Engine<osrm::engine::routing_algorithms::mld::Algorithm>::Route (this=0x563eb55824e0, params=..., result=...)
    at /src/osrm-backend/include/engine/engine.hpp:88
#13 0x0000563eb374f2dd in osrm::OSRM::Route (this=this@entry=0x563eb55824d0, params=..., result=...) at /src/osrm-backend/src/osrm/osrm.cpp:62
#14 0x0000563eb36af348 in osrm::server::service::RouteService::RunQuery (this=0x563eb55835a0, prefix_length=18, query=..., result=...)
    at /src/osrm-backend/src/server/service/route_service.cpp:74
#15 0x0000563eb36b350e in osrm::server::ServiceHandler::RunQuery (this=this@entry=0x563eb5582490, parsed_url=..., result=...) at /src/osrm-backend/src/server/service_handler.cpp:52
#16 0x0000563eb36a2aa5 in osrm::server::RequestHandler::HandleRequest (this=<optimized out>, current_request=..., current_reply=...) at /src/osrm-backend/src/server/request_handler.cpp:69
#17 0x0000563eb3698ae7 in osrm::server::Connection::handle_read (this=0x7fc654000cd0, error=..., bytes_transferred=<optimized out>) at /src/osrm-backend/src/server/connection.cpp:79
#18 0x0000563eb36942e5 in boost::_mfi::mf2<void, osrm::server::Connection, boost::system::error_code const&, unsigned long>::call<std::shared_ptr<osrm::server::Connection>, boost::system::error_code const, unsigned long> (this=this@entry=0x7fc662d0d730, u=..., b1=..., b2=@0x7fc662d0d448: 158, b2@entry=@0x7fc662d0d448: <optimized out>)
    at /usr/include/boost/bind/mem_fn_template.hpp:269
#19 0x0000563eb3694311 in boost::_mfi::mf2<void, osrm::server::Connection, boost::system::error_code const&, unsigned long>::operator()<std::shared_ptr<osrm::server::Connection> > (
    this=this@entry=0x7fc662d0d730, u=..., a1=..., a2=<optimized out>) at /usr/include/boost/bind/mem_fn_template.hpp:283
#20 0x0000563eb369437f in boost::_bi::list3<boost::_bi::value<std::shared_ptr<osrm::server::Connection> >, boost::arg<1> (*)(), boost::arg<2> (*)()>::operator()<boost::_mfi::mf2<void, osrm::server::Connection, boost::system::error_code const&, unsigned long>, boost::_bi::rrlist2<boost::system::error_code const&, unsigned long const&> > (this=this@entry=0x7fc662d0d740,
    f=..., a=...) at /usr/include/boost/bind/bind.hpp:396
#21 0x0000563eb36943d3 in boost::_bi::bind_t<void, boost::_mfi::mf2<void, osrm::server::Connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<std::shared_ptr<osrm::server::Connection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> >::operator()<boost::system::error_code const&, unsigned long const&> (this=0x7fc662d0d730, a1=...,
    a2=<optimized out>) at /usr/include/boost/bind/bind.hpp:1315
#22 0x0000563eb3694403 in boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, osrm::server::Connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<std::shared_ptr<osrm::server::Connection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> >, boost::system::error_code, unsigned long>::operator() (
    this=<optimized out>) at /usr/include/boost/asio/detail/bind_handler.hpp:162
#23 0x0000563eb3694460 in boost::asio::asio_handler_invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, osrm::server::Connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<std::shared_ptr<osrm::server::Connection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> >, boost::system::error_code, unsigned long> > (function=...) at /usr/include/boost/asio/handler_invoke_hook.hpp:67
#24 0x0000563eb369448a in boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, osrm::server::Connection, boost::system::err--Type <RET> for more, q to quit, c to continue without paging--q

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions