From 590421bc0dd8aff8f415745b61288077e7b1da80 Mon Sep 17 00:00:00 2001 From: Kajari Ghosh Date: Tue, 4 Dec 2018 23:26:54 -0500 Subject: [PATCH 1/4] add failing cuke test --- features/testbot/distance_matrix.feature | 27 +++++++++++++++++++++++- src/engine/plugins/table.cpp | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/features/testbot/distance_matrix.feature b/features/testbot/distance_matrix.feature index 83d32d28347..221380b65b9 100644 --- a/features/testbot/distance_matrix.feature +++ b/features/testbot/distance_matrix.feature @@ -666,4 +666,29 @@ Feature: Basic Distance Matrix | a | 0 | 300.2 | 900.7 | 1200.9 | | b | 300.2 | 0 | 600.5 | 900.7 | | f | 900.7 | 600.5 | 0 | 302.2 | - | 1 | 1200.9 | 900.7 | 300.2 | 0 | \ No newline at end of file + | 1 | 1200.9 | 900.7 | 300.2 | 0 | + + Scenario: Testbot - Filling in noroutes with estimates - use snapped coordinate - asymetric + Given a grid size of 300 meters + Given the extract extra arguments "--small-component-size 4" + Given the query options + | fallback_speed | 5 | + | fallback_coordinate | snapped | + Given the node map + """ + a b f h 1 + d e g i + """ + + And the ways + | nodes | + | abeda | + | fhigf | + + When I request a travel distance matrix I should get + | | a | + | a | 0 | + | b | 300.2 | + | f | 900.7 | + | 1 | 1200.9 | + \ No newline at end of file diff --git a/src/engine/plugins/table.cpp b/src/engine/plugins/table.cpp index d1d7786eec8..a9a5f1db7f4 100644 --- a/src/engine/plugins/table.cpp +++ b/src/engine/plugins/table.cpp @@ -103,6 +103,7 @@ Status TablePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms, for (std::size_t column = 0; column < num_destinations; column++) { const auto &table_index = row * num_sources + column; + BOOST_ASSERT(table_index < result_tables_pair.first.size()); if (result_tables_pair.first[table_index] == MAXIMAL_EDGE_DURATION) { const auto &source = From af233b5547f55135e5fd22f0480e1efa0eda36cb Mon Sep 17 00:00:00 2001 From: Kajari Ghosh Date: Tue, 4 Dec 2018 23:34:49 -0500 Subject: [PATCH 2/4] correctly access durations vector --- src/engine/plugins/table.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/plugins/table.cpp b/src/engine/plugins/table.cpp index a9a5f1db7f4..50e41d75b8e 100644 --- a/src/engine/plugins/table.cpp +++ b/src/engine/plugins/table.cpp @@ -102,7 +102,7 @@ Status TablePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms, { for (std::size_t column = 0; column < num_destinations; column++) { - const auto &table_index = row * num_sources + column; + const auto &table_index = row * num_destinations + column; BOOST_ASSERT(table_index < result_tables_pair.first.size()); if (result_tables_pair.first[table_index] == MAXIMAL_EDGE_DURATION) { From d6ac257baa4b273760cf50c4475bde6119aa893a Mon Sep 17 00:00:00 2001 From: Kajari Ghosh Date: Tue, 4 Dec 2018 23:39:27 -0500 Subject: [PATCH 3/4] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e68b286be7..7e2ab425945 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - CHANGED: switch to pre-calculated distances for table responses for large speedup and 10% memory increase. [#5251](https://github.com/Project-OSRM/osrm-backend/pull/5251) - ADDED: new parameter `fallback_speed` which will fill `null` cells with estimated value [#5257](https://github.com/Project-OSRM/osrm-backend/pull/5257) - CHANGED: Remove API check for matrix sources/destination length to be less than or equal to coordinates length. [#5298](https://github.com/Project-OSRM/osrm-backend/pull/5289) + - FIXED: Fix crashing bug when using fallback_speed parameter with more sources than destinations. [#5291](https://github.com/Project-OSRM/osrm-backend/pull/5291) - Features: - ADDED: direct mmapping of datafiles is now supported via the `--mmap` switch. [#5242](https://github.com/Project-OSRM/osrm-backend/pull/5242) - REMOVED: the previous `--memory_file` switch is now deprecated and will fallback to `--mmap` [#5242](https://github.com/Project-OSRM/osrm-backend/pull/5242) From 59cd990510c5d592391943ff8f475c53fb68beec Mon Sep 17 00:00:00 2001 From: Kajari Ghosh Date: Tue, 4 Dec 2018 23:52:31 -0500 Subject: [PATCH 4/4] one more cuke test --- features/testbot/distance_matrix.feature | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/features/testbot/distance_matrix.feature b/features/testbot/distance_matrix.feature index 221380b65b9..f48db123d94 100644 --- a/features/testbot/distance_matrix.feature +++ b/features/testbot/distance_matrix.feature @@ -668,7 +668,7 @@ Feature: Basic Distance Matrix | f | 900.7 | 600.5 | 0 | 302.2 | | 1 | 1200.9 | 900.7 | 300.2 | 0 | - Scenario: Testbot - Filling in noroutes with estimates - use snapped coordinate - asymetric + Scenario: Testbot - Asymetric fallback_speed - more sources than destinations Given a grid size of 300 meters Given the extract extra arguments "--small-component-size 4" Given the query options @@ -691,4 +691,24 @@ Feature: Basic Distance Matrix | b | 300.2 | | f | 900.7 | | 1 | 1200.9 | - \ No newline at end of file + + Scenario: Testbot - Asymetric fallback_speed - more destinations than sources + Given a grid size of 300 meters + Given the extract extra arguments "--small-component-size 4" + Given the query options + | fallback_speed | 5 | + | fallback_coordinate | snapped | + Given the node map + """ + a b f h 1 + d e g i + """ + + And the ways + | nodes | + | abeda | + | fhigf | + + When I request a travel distance matrix I should get + | | a | b | f | 1 | + | a | 0 | 300.2 | 900.7 | 1200.9 |