Skip to content
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

Increase allowed shared memory regions to 512 from ~120. #5185

Merged
merged 1 commit into from
Sep 5, 2018

Conversation

danpat
Copy link
Member

@danpat danpat commented Aug 29, 2018

Issue

Currently, if you try to create more than 128 named datasets, some std::uint8_t values will overflow, and you'll end up overwriting other datasets with different names, and/or crashing.

This change increases the limit to 512. Achieving this requires a few steps:

  1. ::ftok() only uses the lowest 8 bits from the id field, so we need to use more than one lockfile name to differentiate unique keys.
  2. Various variables need to be increased from std::uint8_t to std::uint16_t to hold the larger values.
  3. The ring buffer for swapping datasets needs to be increased so that it doesn't run out of space when lots of datasets are active.

Tasklist

Requirements / Relations

Link any requirements here. Other pull requests this PR is based on?

@TheMarex
Copy link
Member

128 shared memory regions should be enough for everybody

Copy link
Member

@chaupow chaupow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. super minor remarks

package.json Outdated
@@ -1,6 +1,6 @@
{
"name": "osrm",
"version": "5.18.0-latest.1",
"version": "5.18.0-moarshm.3",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for merging to master, we should undo this again, I guess :)

include/storage/shared_memory.hpp Show resolved Hide resolved
@danpat danpat changed the title Increase allowed shared memory regions to 512 from 256. Increase allowed shared memory regions to 512 from ~120. Sep 5, 2018
@danpat danpat force-pushed the danpat_more_shm_regions branch from 15a41ed to 2ff24f6 Compare September 5, 2018 18:08
@danpat danpat merged commit 69d7825 into master Sep 5, 2018
@ghoshkaj ghoshkaj added this to the 5.19.0 milestone Sep 5, 2018
@chaupow chaupow deleted the danpat_more_shm_regions branch September 28, 2018 21:41
datendelphin added a commit to fossgis-routing-server/osrm-backend that referenced this pull request Nov 19, 2020
  - Changes from 5.18.0:
    - Optimizations:
      - CHANGED: Use Grisu2 for serializing floating point numbers. [Project-OSRM#5188](Project-OSRM#5188)
      - ADDED: Node bindings can return pre-rendered JSON buffer. [Project-OSRM#5189](Project-OSRM#5189)
    - Profiles:
      - CHANGED: Bicycle profile now blacklists barriers instead of whitelisting them [Project-OSRM#5076
](Project-OSRM#5076)
      - CHANGED: Foot profile now blacklists barriers instead of whitelisting them [Project-OSRM#5077
](Project-OSRM#5077)
      - CHANGED: Support maxlength and maxweight in car profile [Project-OSRM#5101](Project-OSRM#5101]
    - Bugfixes:
      - FIXED: collapsing of ExitRoundabout instructions [Project-OSRM#5114](Project-OSRM#5114)
    - Misc:
      - CHANGED: Support up to 512 named shared memory regions [Project-OSRM#5185](Project-OSRM#5185)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants