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

Shared memory chunks are lost when the subscriber callback is delayed #364

Closed
sumanth-nirmal opened this issue Jan 10, 2022 · 0 comments · Fixed by #365
Closed

Shared memory chunks are lost when the subscriber callback is delayed #364

sumanth-nirmal opened this issue Jan 10, 2022 · 0 comments · Fixed by #365
Assignees

Comments

@sumanth-nirmal
Copy link
Contributor

sumanth-nirmal commented Jan 10, 2022

Bug report

Required Info:

  • Operating System:
    • Ubuntu 20.04
  • Installation type:
  • Version or commit hash:
    • ROS2 Rolling
    • rmw_cyclonedds version - 1.1.1 cb129b5
  • DDS implementation:
    • rmw_cyclonedds_cpp
  • Client library (if applicable):
    • rclcpp

Steps to reproduce issue

  1. Set up a pub/sub example with all the required SHM constraints
  2. Make the subscriber callback significantly time-consuming
  3. After some iterations, the shared memory chunks pile up and eventually leading to"out of chunks" error.

Actual behavior

When the subscriber callback is expensive and takes significant time to complete, the shared memory chunks are lost

Expected behavior

The shared memory chunks shouldn't be lost in scenarios where the subscriber callbacks take significant time to execute and the chunks should be freed properly.

Additional information

The probable reasoning for why this happens is as follows, when shared memory is enabled, the flow for executing the subscription is first the loaned message is taken, then the callback is executed with the taken loaned message, then once the callback execution is completed the loaned message is returned back to the middleware. However, if the callback is expensive and takes significant time, then in the mean time there are samples also received in the reader history cache, and based on the history depth the samples in the reader history cache will be lost without being processed by the executor. Ideally, when the sample is removed from the reader history cache, the corresponding loan for this sample should also be returned to the middleware, which is not handled correctly in serdata_rmw_free.

The essence is in serdata_rmw_free the loan is not returned to the middleware if there is an outstanding loan.

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 a pull request may close this issue.

1 participant