-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Division by zero in printCellStatistics() #6121
Comments
@pservit just to confirm, do you get the same error when running |
Sorry, above logs from osrm-partition |
Summing the bit sizes: 22 + 18 + 14 + 10 = 64. |
This test reproduces the issue BOOST_AUTO_TEST_CASE(cell_bit_overflow)
{
std::vector<size_t> level_cells = {2458529, 258451, 16310, 534};
std::vector<std::vector<CellID>> levels(level_cells.size(), std::vector<CellID>(level_cells[0]));
std::vector<uint32_t> levels_to_num_cells(level_cells.size());
auto level = 0;
for (auto num_cells : level_cells)
{
for (auto val : util::irange<size_t>(0ULL, level_cells[0])) {
levels[level][val] = std::min(val, num_cells-1);
}
levels_to_num_cells[level] = num_cells;
++level;
}
MultiLevelPartition mlp{levels, levels_to_num_cells};
BOOST_REQUIRE_EQUAL(mlp.GetNumberOfCells(1), level_cells[0]);
BOOST_REQUIRE_EQUAL(mlp.GetNumberOfCells(2), level_cells[1]);
BOOST_REQUIRE_EQUAL(mlp.GetNumberOfCells(3), level_cells[2]);
BOOST_REQUIRE_EQUAL(mlp.GetNumberOfCells(4), level_cells[3]);
} It fails with
In Debug builds this test triggers an assertion when building Level masks
NUM_PARTITION_BITS is 64 unless your architecture is not using 8 bit chars.
This means there's an inconsistency with an earlier check. A runtime error should be thrown earlier, but it's only doing so for > 64 bit. This needs to be >= 64. osrm-backend/include/partitioner/multi_level_partition.hpp Lines 189 to 194 in 8e100ea
|
In summary, the OSM planet foot graph appears to now be too big for the OSRM MLD defaults. I believe a workaround would be to reduce the number of cells at each level by increasing their maximum size.
|
thank you! tested
now I'm waiting for |
gdb backtrace: backtrace.txt |
with debug symbols: osrm-backend version 5.22.0 |
Thanks for the additional debug logs, that really helped. It's another overflow issue. Each cell has source and destination nodes. MLD is keeping a |source| x |destination| sized table for various metrics (distances, durations, etc) from each source to all destinations in a cell. It stores all of the values for a metric in one large array, with an offset for each cell to find its values.
The offset is... 32 bit
Looking at the cell data from the backtrace:
Immediately we can see the first cell has 5908884 sources and 9553299 destinations, which is suspiciously large given the cell sizes were limited to 1024 at this level.
Nevertheless, with 456991 cells and a conservative estimate of 250 sources and 250 destinations per cell, an overflow will still occur. |
Applying #6085 will help reduce the size of this array, but you'll need to increase the osrm-backend/include/partitioner/cell_storage.hpp Lines 55 to 56 in 8e100ea
|
with this patch customize and routed works normally diff --git a/include/partitioner/cell_storage.hpp b/include/partitioner/cell_storage.hpp
index 42c347861..40ddc17ed 100644
--- a/include/partitioner/cell_storage.hpp
+++ b/include/partitioner/cell_storage.hpp
@@ -52,8 +52,8 @@ namespace detail
template <storage::Ownership Ownership> class CellStorageImpl
{
public:
- using ValueOffset = std::uint32_t;
- using BoundaryOffset = std::uint32_t;
+ using ValueOffset = std::uint64_t;
+ using BoundaryOffset = std::uint64_t;
using BoundarySize = std::uint32_t;
using SourceIndex = std::uint32_t;
using DestinationIndex = std::uint32_t; just some information: |
That is great information, how much memory for the runtime? Are you using |
not using mmap |
osrm-partition always fails processing planet after osrm-extract with foot profile.
After some debugging and adding logs I found that
partition.GetNumberOfCells
returns 0 for level=4 so division by zero occurs in printCellStatistics() line 42Here is full log for osrm-partition:
I'm not familiar with osrm-backend internals. Is it normal behaviour to have zero cells on level 4 in MultiLevelPartition (notice
[info] level 4 #cells 534 bit size 10
in edge-based-graph annotation stats)?The text was updated successfully, but these errors were encountered: