Commit Graph

1682 Commits

Author SHA1 Message Date
Dennis Luxen
99809e105c
Upgrade clang compiler in CI builds (#6861) 2024-05-06 18:12:17 +02:00
Dennis Luxen
7f9d591ab7
Upgrade clang-format to version 15 (#6859) 2024-05-06 09:14:46 +02:00
Michael Bell
b503e96a98
Remove force-loop checks for routes with u-turns (#6858)
Each leg of a via-route supporting u-turns does not need to consider
force-loops. Negative weight checks are sufficient to prevent
incorrect results when waypoints are on the same edge.
2024-05-05 21:56:01 +01:00
Matthew Wigginton Bhagat-Conway
7ebd21f39e
pass flags into process_segment (#6658)
* pass flags into process_segment

---------

Co-authored-by: Michael Bell <michael@mjjbell.com>
2024-04-06 09:27:42 +01:00
Michael Bell
8ef366e061
Add support for opposite approach request parameter (#6842)
* Added approach on the opposite side of the road.

* Additional test and docs coverage for opposite approach

---------

Co-authored-by: Aleksandrs Saveljevs <Aleksandrs.Saveljevs@gmail.com>
2024-04-03 19:59:15 +01:00
Michael Bell
d0e3e2af23
Extract prerelease/build information from package semver (#6839)
* Extract prerelease/build information from package semver

Currently we only extract the major.minor.patch identifiers from
the semver label stored in package.json.

This leads to version information in executables incorrectly
reporting a release version is running on prereleases and special builds.

This commit is a quickfix to extract this information and report it
in version strings.

CMake regex parsing is not sophisticated enough to handle the full semver
regex, so we might need to explore other CMake modules if we want to
strictly parse the label.
2024-03-24 18:33:07 +00:00
martin
8526cc7d45
Replace deprecated std::is_pod (#6717)
* Replace deprecated std::is_pod
2024-03-17 11:49:55 +00:00
Monday
6e77d53946
Correctly handle compressed traffic signals (#6724)
Unidirectional traffic signal segments are currently not compressed.
This means traffic signals which are not on turns can be missed and
not applied the correct penalty.

This commit changes this behaviour to correctly handle the graph
compression. Additional tests are added to ensure there is no
regression for other cases (turns, restrictions).

Co-authored-by: Michael Bell <michael@mjjbell.com>
2024-03-17 11:32:10 +00:00
Daniel Patterson
31e31a63d0
Fix some compilation issues on modern macOS systems (#6709)
* Fix various compiler warnings generated by Apple clang 15, and workaround some boost 1.8 bugs

* Fix formatting.
2023-10-12 23:04:39 +02:00
fenwuyaoji
14dcf91812
add keepalive_timeout flag (#6674)
* add keepalive_timeout flag
2023-08-30 19:06:39 +01:00
Whytro
3f9347cfb2
Fix operator overload on RouteParameters (#6646)
* Fix operator overload on RouteParameters
2023-08-19 21:48:15 +01:00
Michael Bell
db7946d762
Add support for disabling feature datasets (#6666)
This change adds support for disabling datasets, such that specific
files are not loaded into memory when running OSRM. This enables users
to not pay the memory cost for features they do not intend to use.

Initially, there are two options:
- ROUTE_GEOMETRY, for disabling overview, steps, annotations and waypoints.
- ROUTE_STEPS, for disabling steps only.

Attempts to query features for which the datasets are disabled will
lead to a DisabledDatasetException being returned.
2023-08-04 18:43:37 +01:00
Michael Bell
3bb82ce1e2
Minor fixes (#6655)
* Ensure required file check in osrm-routed is correctly enforced.

The storage module had a stricter check. This keeps the IOConfig
check in sync.

* Correct HTTP docs to reflect summary output dependency on steps parameter.

There is no summary parameter.

* npm audit fix
2023-07-18 20:23:23 +01:00
Lasse Liehu
af59a9cfae
Fix build with GCC 13 (#6632)
Building with GCC 13 failed because for example std::int32_t
was not found. Porting guide [1] suggested to add explicit includes
for <cstdint> if necessary, so did just that.

[1]: https://gcc.gnu.org/gcc-13/porting_to.html
2023-05-31 07:53:04 +02:00
Whytro
72da455185
Allow -1.0 as unlimited for default_radius value (#6599) 2023-05-31 07:52:35 +02:00
Al
0ca913132a
Added block_counter variable to a preprocessor check, minor bug. (#6596) 2023-04-16 23:22:30 +02:00
Whytro
d51631401e
Add support for a default_bearing_radius flag (#6575) 2023-03-24 16:49:33 +01:00
Matthew Wigginton Bhagat-Conway
d6afe91d8f
print tracebacks and line numbers for Lua runtime errors (#6564)
* print tracebacks and line numbers for Lua runtime errors

* revert format changes

* update changelog with lua traceback, #6564

* revert using protected_function for old GetStringListFromFunction and source_function #6564

* add unit test for line numbers in tracebacks, #6564

* apply clang-format (#6564)

* remove unused test helper function, #6564

* suppress leaksanitizer warnings in extract-tests, #6564

When the extractor encounters a lua runtime error, some osmium objects are not freed. In production this doesn't matter because these errors bring down OSRM. In the tests we catch them to ensure they occur, and the leaksanitizer flags them.
2023-03-23 19:18:58 +01:00
Jingchen Ye
0e7c3d8ad4
Move TarjanSCC from extractor to util (#6562) 2023-03-09 17:47:28 +01:00
zephyr
ebd9ab4548
fix(json_render): json_render is not accurate enough for extremely sm… (#6531) 2023-02-02 18:58:25 +01:00
Jeremiah
e590dae5f6
Fix boost header deprecation warning (#6515) 2023-01-21 08:47:05 +01:00
Dennis Luxen
7c06726a35 Fix formatting 2022-12-20 18:00:11 +01:00
Dennis Luxen
d7c44f0bc0 Merge remote-tracking branch 'origin/master' into nested_namespace 2022-12-11 10:25:13 +01:00
Dennis Luxen
a4aa153ba4 Use nested namespace
It's a mechanical change to modernize the code base
2022-12-11 10:17:17 +01:00
Dennis Luxen
612ca82a06 Fix formatting 2022-12-10 20:01:16 +01:00
Dennis Luxen
1215062e4c Port the used bits from CheapRuler, drop dependencies 2022-12-10 19:54:51 +01:00
Dennis Luxen
c605b1db38 Fix typo 2022-12-10 16:28:03 +01:00
Dennis Luxen
f4189d9487 Fix formatting 2022-12-10 16:08:22 +01:00
Dennis Luxen
f983d626ac Merge remote-tracking branch 'origin/master' into dl_using_keyword 2022-12-10 16:02:53 +01:00
Siarhei Fedartsou
73b2a86a95
Move vector in CSVFilesParser instead copying it (#6470) 2022-12-03 17:53:56 +01:00
Siarhei Fedartsou
2044398dfd
Add CI job which builds OSRM with gcc 12 (#6455) 2022-11-28 16:29:43 +01:00
Siarhei Fedartsou
095b726a92
Use <boost/iterator/function_output_iterator.hpp> instead of deprecated <boost/function_output_iterator.hpp> (#6458) 2022-11-16 21:09:54 +01:00
Siarhei Fedartsou
18dcd27a9b
Use node-api instead of NAN (#6452) 2022-11-16 15:44:36 +01:00
Siarhei Fedartsou
5f82d0c9ba
Get rid of unused functions in util/json_util.hpp (#6446) 2022-11-06 21:13:04 +01:00
Dennis Luxen
8bff55cd85 [CPP17] Modernize: Replace typedef with using statements 2022-11-06 13:21:45 +01:00
Dennis Luxen
bb4fd93fab Fix formatting 2022-11-06 12:26:37 +01:00
Dennis Luxen
b13820f520 Use std::back_inserter 2022-11-06 12:19:32 +01:00
Dennis Luxen
a1c1fefd6e Fix formatting, pass by value 2022-11-04 11:49:54 +01:00
Dennis Luxen
7359d6a21b Merge remote-tracking branch 'origin/master' into replace_boost_stringref 2022-11-04 11:43:41 +01:00
Dennis Luxen
5dda33fa88 More efficient toLower implementation 2022-11-04 11:42:37 +01:00
Dennis Luxen
5280ca4e16 Pass string_view by value 2022-11-04 11:41:02 +01:00
Dennis Luxen
85e6a854aa Fix missing includes (on Windows) 2022-10-30 22:08:29 +01:00
Dennis Luxen
12f49d6f24 Stray whitespace 2022-10-30 20:11:36 +01:00
Dennis Luxen
7149547645 Fix formatting 2022-10-30 20:10:09 +01:00
Dennis Luxen
565959b389 Remove util/string_view header 2022-10-30 20:01:46 +01:00
Dennis Luxen
5c9d0d152c Remove usage of StringView typedef 2022-10-30 19:53:26 +01:00
Dennis Luxen
274dcc58a5 Remove superflous std::hash specialization 2022-10-30 19:21:06 +01:00
Dennis Luxen
d06b23d819 More fixes 2022-10-30 14:08:17 +01:00
Dennis Luxen
91e9623b31 Fix formatting 2022-10-30 14:06:19 +01:00
Dennis Luxen
0021ccef59 Replace boost::string_ref with std::string_view 2022-10-30 13:59:59 +01:00
Dennis Luxen
061f0a1f14 Fix includes 2022-10-30 11:43:28 +01:00
Dennis Luxen
f97e18d285 Fix formatting 2022-10-29 23:01:38 +02:00
Dennis Luxen
7b73b977ff Replace boost::unordered_{map/set} with std, also remove code duplication 2022-10-29 22:57:14 +02:00
Michael Bell
5d468f2897
Make edge metrics strongly typed (#6421)
This change takes the existing typedefs for weight, duration and
distance, and makes them proper types, using the existing Alias
functionality.

Primarily this is to prevent bugs where the metrics are switched,
but it also adds additional documentation. For example, it now
makes it clear (despite the naming of variables) that most of the
trip algorithm is running on the duration metric.

I've not made any changes to the casts performed between metrics
and numeric types, they now just more explicit.
2022-10-28 15:16:12 +01:00
Siarhei Fedartsou
c1d2c15995
Handle snapping parameter for all plugins in NodeJs bindings, but not for Route only (#6417) 2022-10-22 16:49:35 +02:00
Siarhei Fedartsou
fb1bb7a15b
Fix annotations=true handling in NodeJS bindings & libosrm (#6415) 2022-10-19 08:35:18 +02:00
Siarhei Fedartsou
9d160a9b5d
Revert back to using custom HTTP parser instead of Boost.Beast (#6407) 2022-10-14 14:37:33 +02:00
Siarhei Fedartsou
d143de597d
Fix bug with large HTTP requests leading to Bad Request in osrm-routed. (#6403) 2022-10-13 16:53:49 +02:00
Siarhei Fedartsou
9a4b4648f4
Improve performance of JSON rendering (#6380) 2022-10-03 21:43:51 +02:00
Siarhei Fedartsou
21888334dd
Do not generate intermediate .osrm file in osrm-extract. (#6354) 2022-09-30 14:29:10 +02:00
Siarhei Fedartsou
902bfc7806
Refactor CMake code related to compiler warnings, enable some additional warnings (#6355) 2022-09-30 11:42:36 +02:00
Siarhei Fedartsou
3c5d99b4cb
Improve performance of map matching via getPathDistance optimization (#6378) 2022-09-29 22:27:19 +02:00
Siarhei Fedartsou
be353630d5
Fix a couple of warnings found by PVS Studio (#6372) 2022-09-22 23:28:12 +02:00
Siarhei Fedartsou
9b834810d5
Build Node bindings on Windows (#6334)
Extends CI to build NodeJS bindings for Windows.
2022-09-20 20:43:13 +01:00
Siarhei Fedartsou
96f5780f06
Update CI to use clang-tidy 14 (#6353) 2022-08-31 23:39:47 +02:00
Siarhei Fedartsou
9a638f3568
Optimize RestrictionParser performance (#6344) 2022-08-30 21:08:52 +02:00
Siarhei Fedartsou
2cf957148b
Support floats for speed value in traffic updates CSV (#6327) 2022-08-30 15:34:46 +02:00
Michael Bell
b17cbb4c47
Support OSM traffic signal directions (#6153)
Currently OSRM parses traffic signal nodes without consideration
for the direction in which the signal applies. This can lead
to duplicated routing penalties, especially when a forward and backward
signal are in close proximity on a way.

This commit adds support for directed signals to the extraction and
graph creation. Signal penalties are only applied in the direction
specified by the OSM tag.

We add the assignment of traffic directions to the lua scripts,
maintaining backwards compatibility with the existing boolean
traffic states.

As part of the changes to the internal structures used for tracking
traffic signals during extraction, we stop serialising/deserialising
signals to the `.osrm` file. The traffic signals are only used by
`osrm-extract` so whilst this is a data format change, it will not
break any existing user processes.
2022-08-30 10:36:49 +01:00
Siarhei Fedartsou
b4142cf1a2
Add Flatbuffers support to NodeJS bindings (#6338) 2022-08-29 22:01:26 +02:00
Michael Bell
d74e7b66bd
Support snapping to multiple ways at an input location (#5953)
This PR improves routing results by adding support for snapping to
multiple ways at input locations.

This means all edges at the snapped location can act as source/target
candidates for routing search, ensuring we always find the best route,
and not the one dependent on the edge selected.
2022-08-27 11:36:20 +01:00
Siarhei Fedartsou
df3c553f4f
Remove redundant nullptr check. (#6326) 2022-08-25 00:01:56 +02:00
Siarhei Fedartsou
91895604c9
Migrate to modern TBB version (#6300) 2022-08-24 18:13:49 +02:00
Michael Bell
a98074a051
Improvements to maneuver override processing (#6215)
This change unblocks the osrm-extract debug build, which is
currently failing on a maneuver override assertion.

The processing of maneuver overrides currently has three issues
- It assumes the via node(s) can't be compressed (the failing assertion)
- It can't handle via-paths containing incompressible nodes
- It doesn't interop with turn restriction on the same path

Turn restrictions and maneuver overrides both use the same
from-via-to path representation.
Therefore, we can fix these issues by consolidating their
structures and reusing the path representation for
turn restrictions, which already is robust to the above
issues.

This also simplifies some of the codebase by removing maneuver
override specific path processing.

There are ~100 maneuver overrides in the OSM database, so the
impact on processing and routing will be minimal.
2022-08-24 16:19:24 +01:00
Siarhei Fedartsou
8e74b7af9d
Enable performance-move-const-arg clang-tidy check (#6319) 2022-08-23 19:03:41 +02:00
Maciej Bukczynski
32fb8607e4
Add node_osrm support for skip_waypoints parameter (#6060) 2022-08-22 21:47:47 +02:00
Lev Dragunov
928867c520
Add data_version field to responses of all plugins. (#5387) 2022-08-22 21:07:32 +02:00
Michael Bell
972a848094
Lazily generate optional route path data (#6045)
Currently route results are annotated with additional path information,
such as geometries, turn-by-turn steps and other metadata.

These annotations are generated if they are not requested or returned
in the response.
Datasets needed to generate these annotations are loaded and available
to the OSRM process even when unused.

This commit is a first step towards making the loading of these datasets
optional. We refactor the code so that route annotations are only
generated if explicitly requested and needed in the response.

Specifically, we change the following annotations to be lazily generated:
- Turn-by-turn steps
- Route Overview geometry
- Route segment metadata

For example. a /route/v1 request with
steps=false&overview=false&annotations=false
would no longer call the following data facade methods:
- GetOSMNodeIDOfNode
- GetTurnInstructionForEdgeID
- GetNameIndex
- GetNameForID
- GetRefForID
- GetTurnInstructionForEdgeID
- GetClassData
- IsLeftHandDriving
- GetTravelMode
- IsSegregated
- PreTurnBearing
- PostTurnBearing
- HasLaneData
- GetLaneData
- GetEntryClass

Requests that include segment metadata and/or overview geometry
but not turn-by-turn instructions will also benefit from this,
although there is some interdependency with the step instructions
- a call to GetTurnInstructionForEdgeID is still required.
Requests for OSM annotations will understandably still need to
call GetOSMNodeIDOfNode.

Making these changes unlocks the optional loading of data contained in
the following OSRM files:
- osrm.names
- osrm.icd
- osrm.nbg_nodes (partial)
- osrm.ebg_nodes (partial)
- osrm.edges
2022-08-22 12:59:20 +01:00
Michael Bell
3cfd0e8334
Complete support for no_entry and no_exit turn restrictions (#5988)
The internal representation of turn restrictions expects only one
`from` way and only one `to` way.

`no_entry` and `no_exit` turn restrictions can have multiple `from` and
`to` ways respectively. This means they are not fully supported by
OSRM's restriction parser.

We complete support for these turn restriction types by parsing all
ways and converting a valid restriction with multiple `from`/`to` members
into multiple internal restrictions.
2022-08-22 12:58:16 +01:00
Rafael Guglielmetti
e3c7995b00
Add missing files in exception message (#5360) 2022-08-22 08:32:25 +02:00
Michael Bell
7f014bd616 Clarify identifier types used in data facade
The data facade interface contains numerous methods for looking up
datapoints by identifiers.
Many of the parameters use the NodeID or EdgeID types. However, these two
identifier types are used for representing three different contexts:

1. Node-based graph edges and nodes
2. Edge-based graph edges and nodes
3. Packed geometries

Consider the use of identifier parameters in these examples:

---

GetWeightPenaltyForEdgeID(const EdgeID id)  <- edge-based edge

GetUncompressedForwardWeights(const EdgeID id) <- packed geometry

IsLeftHandDriving(const NodeID id) <- edge-based node

GetBearingClass(const NodeID node) <- node-based node

---

This mixing of contexts within the same interface makes it
difficult to understand the relationships and dependencies between
the OSRM datasets.

For 1. and 2. we continue to use the NodeID and EdgeID types, but
change the interface parameter names to identify them as
edge-based or node-based graph properties.

For 3. we define a new type definition, PackedGeometryID.

These changes are to aid with readability. A next step would be
to strongly type these definitions, leveraging the Alias template
already used for OSM identifiers.
2022-08-21 21:37:39 +02:00
Siarhei Fedartsou
aadc088084
Fix distance calculation consistency. (#6315)
Consolidate great circle distance calculations to use cheap ruler library.
2022-08-19 22:31:40 +01:00
Siarhei Fedartsou
51a8486375
Fix performance issues after migration to sol2 3.3.0 (#6304)
* Fix performance issues after migration to sol2 3.3.0
2022-08-15 23:10:56 +01:00
Siarhei Fedartsou
e7185b4bcb
Use Boost.Beast to parse HTTP request (#6294) 2022-08-02 21:12:05 +01:00
Siarhei Fedartsou
00816722dd
Configure Undefined Behaviour Sanitizer (#6290) 2022-08-01 22:40:26 +01:00
Siarhei Fedartsou
4e8ee288d9
Migrate to C++17. Update sol2 to 3.3.0. (#6279)
* Migrate to C++17. Update sol2 to 3.3.0.
2022-07-31 00:56:17 +01:00
Siarhei Fedartsou
06b1b980bb
Enable even more clang-tidy checks (#6273) 2022-07-04 21:46:59 +01:00
Siarhei Fedartsou
3d2db20777
Enable more clang-tidy checks. (#6270)
* Enable more clang-tidy checks
2022-06-30 14:32:12 +01:00
Siarhei Fedartsou
59953172e8
Configure clang-tidy job on CI (#6261) 2022-06-28 00:14:28 +01:00
Michael Bell
04c2167c2d Fix for_each_indexed util function
- Fix typo in util function name for_each_indexed.
- Use the overloaded functions for_each_indexed and for_each_pair
  with a container argument where possible to improve readability.
2021-12-22 23:40:06 +00:00
Daniel Patterson
d5cd702242
Enable all unit tests (#5248)
* Add missing profile name to library extract test.

* Support both tzid and TZID properties on timezone geometry.  Improve validation of timezone polygons.

* Missing tzid property wasn't a geojson validation issue, shouldn't have been tested there.

* Use filesystem glob to loop over all test executables so we don't miss any in the future.

Co-authored-by: Michael Bell <michael@mjjbell.com>
2021-10-22 22:10:25 +01:00
Michael Bell
56a427f839 Upgrade Boost to 1.70, fix inefficient connection handling
A request to osrm-routed can be assigned to a thread which
is currently busy processing another request, even when there
are other threads/cores available. This unnecessarily delays
the response, and can make requests appear to hang when
awaiting CPU intensive requests to finish.

The issue looks like a bug in Boost.Asio multithreaded
networking stack.

osrm-routed server implementation is
heavily influenced by the HTTP server 3 example in the
Boost.Asio docs. By upgrading to Boost 1.70 and updating the
server connections to match the example provided in the 1.70
release, the problem is resolved.

The diff of the changes to the Boost.Asio stack are
vast, so it's difficult to identify the exact cause. However
the implementation change is to push the strand of execution
into the socket (and timer) objects, which suggests it could
fix the type of threading issue we are observing.
2021-09-30 22:51:12 +01:00
Michael Bell
f6349a7fbe
Fix metric offset overflow for large MLD partitions (#6124)
Each MLD 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 currently
limited to 32 bit values, which overflows on very large graphs
(e.g. Planet OSM).

We fix this by changing the offsets to be uint64_t types.
2021-09-21 19:25:30 +01:00
Michael Bell
f1f96166c5
Fix MLD level mask generation to support 64-bit masks. (#6123)
The generation of level masks for compactly storing partition cells
supports sizes that can be stored in 64 bits.

The current implementation fails if the total bit sum is 64 bits
exactly. A bit shift mechanism is used that is undefined when the
shift size is equal to the bit size of the underlying type. This
generates an incorrect mask value.

We fix this by adding a special case for a 64 bit offset. Given this
code is called at most |level| times, there will be no effect on
performance. We also update the assertions to reflect 64 bit masks
are now supported.
2021-09-21 18:09:38 +01:00
Michael Bell
f1a6056953 Immediately close bad connections to prevent file exhaustion
osrm-routed does not immediately clean up a keep-alive connection
when the client closes it. Instead it waits for five seconds
of inactivity before removing.

Given a setup with low file limits and clients opening and
closing a lot of keep-alive connections, it's possible for
osrm-routed to run out of file descriptors whilst it waits for
the clean-up to trigger.

Furthermore, this causes the connection acceptor loop to exit.
Even after the old connections are cleaned up, new ones
will not be created. Any new requests will block until the
server is restarted.

This commit improves the situation by:

- Immediately closing connections on error. This includes EOF errors
indicating that the client has closed the connection. This releases
resources early (including the open file) and doesn't wait for the
timer.

- Log when the acceptor loop exits. Whilst this means the behaviour
can still occur for reasons other than too many open files,
we will at least have visibility of the cause and can investigate further.
2021-09-04 01:55:36 +01:00
Michael Bell
50f5a753ea Increase PackedOSMIDs size to 34 bits
OSM node 2^33 was created in early April 2021. This and all
subsequently created IDs will be overflowing OSRM node storage
which only support 33 bit IDs.
Bump the number of bits to 34 to double node ID capacity. This
is a breaking change to the data format as it alters the layout
of .osrm.nbg_nodes.
2021-04-24 23:41:02 +01:00
Karen Shea
a613375460
Validate source/destination indices correctly in nodejs support (#5595)
* validate source/destination indices correctly

Co-authored-by: Denis Chapligin <denis.chaplygin@wolt.com>
Co-authored-by: Daniel Patterson <danpat@danpat.net>
2021-01-28 06:02:01 -08:00
Richard Fairhurst
960269f95a
Merge pull request #5131 from themylogin/master
Fix turn.roads_on_the_left and turn.roads_on_the right for two-way roads
2021-01-28 14:00:17 +00:00
Michael Bell
bd3eb6591e
Undo libosrm API break by adding old interface as method overload (#5861)
Removes the breaking libosrm API change by adding the old interface to
the new. This does not introduce any new breaks.

The downside of this is that it allows for multiple ways to
return JSON responses.
2021-01-27 09:14:44 -08:00
themylogin
b0b8069ab0 clang-format 2021-01-27 13:12:20 +01:00
themylogin
d9d873903f Account merged edges when processing turn legs 2021-01-27 10:53:48 +01:00