Compare commits

...

8 Commits

Author SHA1 Message Date
Daniel Patterson
434a3a638a Make Travis buildit. 2016-12-21 15:31:03 -08:00
Daniel Patterson
6305f4a529 Update changelog and version. 2016-12-21 15:18:30 -08:00
Patrick Niklaus
646b1631ab Revert "Smarter search radius formula for map matching"
This reverts commit b73c59088c.
2016-12-21 15:14:33 -08:00
Patrick Niklaus
a852ab1c43 Revert "Fix capture"
This reverts commit 4f81e31d63.
2016-12-21 15:14:33 -08:00
Patrick Niklaus
ff25fc70f0 Revert "Hardcode search radius parameters"
This reverts commit 2c9e18d5a9.
2016-12-21 15:14:33 -08:00
Patrick Niklaus
b34ed587d0 Revert "Fix call to std::min"
This reverts commit 8bb183bc8c.
2016-12-21 15:14:33 -08:00
Daniel Patterson
b58329104a Bump version field and update CHANGELOG. 2016-12-16 13:58:21 -08:00
Patrick Niklaus
d188e8e2a8 Fix changing shared memory in multi-process setup (#3462)
This change fixes two bugs:

1. A dead-lock that occurs between osrm-datastore and libosrm when an
   old dataset is free during a data update. This happened because the
   mutexes where acquired in a different order.

2. A region is deleted eventhough it is still in use. This happens when
   libosrm gets overtaken by osrm-datastore, so the new dataset is in
   the same region the old one was.
2016-12-16 13:54:57 -08:00
5 changed files with 32 additions and 19 deletions

View File

@ -13,6 +13,7 @@ notifications:
branches: branches:
only: only:
- master - master
- 5.5
cache: cache:
ccache: true ccache: true

View File

@ -1,3 +1,12 @@
# 5.5.2
- Changes from 5.5.1
- Revert smarter map-matching search radius. The increased radius causes performance degredation when map-matching against non-car road networks with more edges.
# 5.5.1
- Changes from 5.5.0
- Bugfixes
- Fixes #3455 where a deadlock could occur if re-loading new data under heavy load with multiple consumers osrm-datastore
# 5.5.0 # 5.5.0
- Changes from 5.4.0 - Changes from 5.4.0
- API: - API:

View File

@ -53,7 +53,7 @@ endif()
project(OSRM C CXX) project(OSRM C CXX)
set(OSRM_VERSION_MAJOR 5) set(OSRM_VERSION_MAJOR 5)
set(OSRM_VERSION_MINOR 5) set(OSRM_VERSION_MINOR 5)
set(OSRM_VERSION_PATCH 0) set(OSRM_VERSION_PATCH 2)
set(OSRM_VERSION "${OSRM_VERSION_MAJOR}.${OSRM_VERSION_MINOR}.${OSRM_VERSION_PATCH}") set(OSRM_VERSION "${OSRM_VERSION_MAJOR}.${OSRM_VERSION_MINOR}.${OSRM_VERSION_PATCH}")
add_definitions(-DOSRM_PROJECT_DIR="${CMAKE_CURRENT_SOURCE_DIR}") add_definitions(-DOSRM_PROJECT_DIR="${CMAKE_CURRENT_SOURCE_DIR}")

View File

@ -38,29 +38,33 @@ class SharedMemoryDataFacade : public ContiguousInternalMemoryDataFacadeBase
// used anymore. We crash hard here if something goes wrong (noexcept). // used anymore. We crash hard here if something goes wrong (noexcept).
virtual ~SharedMemoryDataFacade() noexcept virtual ~SharedMemoryDataFacade() noexcept
{ {
// Now check if this is still the newest dataset
boost::interprocess::sharable_lock<boost::interprocess::named_upgradable_mutex>
current_regions_lock(shared_barriers->current_regions_mutex,
boost::interprocess::defer_lock);
boost::interprocess::scoped_lock<boost::interprocess::named_sharable_mutex> exclusive_lock( boost::interprocess::scoped_lock<boost::interprocess::named_sharable_mutex> exclusive_lock(
data_region == storage::DATA_1 ? shared_barriers->regions_1_mutex data_region == storage::DATA_1 ? shared_barriers->regions_1_mutex
: shared_barriers->regions_2_mutex, : shared_barriers->regions_2_mutex,
boost::interprocess::defer_lock); boost::interprocess::defer_lock);
// if this returns false this is still in use // if this returns false this is still in use
if (exclusive_lock.try_lock()) if (current_regions_lock.try_lock() && exclusive_lock.try_lock())
{ {
if (storage::SharedMemory::RegionExists(data_region)) if (storage::SharedMemory::RegionExists(data_region))
{ {
BOOST_ASSERT(storage::SharedMemory::RegionExists(layout_region)); BOOST_ASSERT(storage::SharedMemory::RegionExists(layout_region));
// Now check if this is still the newest dataset
const boost::interprocess::sharable_lock<boost::interprocess::named_upgradable_mutex>
lock(shared_barriers->current_regions_mutex);
auto shared_regions = storage::makeSharedMemory(storage::CURRENT_REGIONS); auto shared_regions = storage::makeSharedMemory(storage::CURRENT_REGIONS);
const auto current_timestamp = const auto current_timestamp =
static_cast<const storage::SharedDataTimestamp *>(shared_regions->Ptr()); static_cast<const storage::SharedDataTimestamp *>(shared_regions->Ptr());
if (current_timestamp->timestamp == shared_timestamp) // check if the memory region referenced by this facade needs cleanup
if (current_timestamp->data == data_region)
{ {
util::Log(logDEBUG) << "Retaining data with shared timestamp " << shared_timestamp; BOOST_ASSERT(current_timestamp->layout == layout_region);
util::Log(logDEBUG) << "Retaining data with shared timestamp "
<< shared_timestamp;
} }
else else
{ {

View File

@ -19,14 +19,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
static double search_radius_for_gps_radius(double gps_radius)
{
// For a given GPS radius, determine the radius we need to search for candidate street segments
// to have a 99.9% chance of finding the correct segment.
// For more detail, see the analysis at https://github.com/Project-OSRM/osrm-backend/pull/3184
return std::min(gps_radius * 3.5 + 45, 200.0);
}
namespace osrm namespace osrm
{ {
namespace engine namespace engine
@ -160,9 +152,16 @@ Status MatchPlugin::HandleRequest(const std::shared_ptr<datafacade::BaseDataFaca
std::transform(parameters.radiuses.begin(), std::transform(parameters.radiuses.begin(),
parameters.radiuses.end(), parameters.radiuses.end(),
search_radiuses.begin(), search_radiuses.begin(),
[&](const boost::optional<double> &maybe_radius) { [](const boost::optional<double> &maybe_radius) {
double gps_radius = maybe_radius ? *maybe_radius : DEFAULT_GPS_PRECISION; if (maybe_radius)
return search_radius_for_gps_radius(gps_radius); {
return *maybe_radius * RADIUS_MULTIPLIER;
}
else
{
return DEFAULT_GPS_PRECISION * RADIUS_MULTIPLIER;
}
}); });
} }