eclipse-iceoryx / iceoryx2

Eclipse iceoryx2™ - true zero-copy inter-process-communication in pure Rust
https://iceoryx.io
Apache License 2.0
449 stars 22 forks source link

[#116] Fix retrieve buffer overflow #117

Closed elfenpiff closed 4 months ago

elfenpiff commented 4 months ago

Notes for Reviewer

The retrieve buffer can overflow when the publisher loans many samples and send them one by one without any more loans. The problem is, that the samples in the retrieve buffer are only recollected whenever a new loan is acquired. When we never have to call loan again since we have a big buffer of loaned samples on the publisher side, the retrieve buffer will overflow and the communication fails.

The solution is rather simple: Call retrieve_returned_samples before sending any new samples. In this way, we ensure that we reclaim all borrowed samples before we borrow (send) new samples to the receiver.

Pre-Review Checklist for the PR Author

  1. [x] Add sensible notes for the reviewer
  2. [x] PR title is short, expressive and meaningful
  3. [x] Relevant issues are linked
  4. [x] Every source code file has a copyright header with SPDX-License-Identifier: Apache-2.0 OR MIT
  5. [x] Branch follows the naming format (iox2-123-introduce-posix-ipc-example)
  6. [x] Commits messages are according to this guideline
    • [x] Commit messages have the issue ID ([#123] Add posix ipc example)
    • [x] Commit author matches Eclipse Contributor Agreement (and ECA is signed)
  7. [x] Tests follow the best practice for testing
  8. [x] Changelog updated in the unreleased section including API breaking changes
  9. [x] Assign PR to reviewer
  10. [x] All checks have passed (except task-list-completed)

Checklist for the PR Reviewer

Post-review Checklist for the PR Author

  1. [x] All open points are addressed and tracked via issues

References

Use either 'Closes #123' or 'Relates to #123' to reference the corresponding issue.

Relates to #116

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (dfd44b1) 77.36% compared to head (dcdc80f) 77.36%.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/eclipse-iceoryx/iceoryx2/pull/117/graphs/tree.svg?width=650&height=150&src=pr&token=FN3YFXTJCI&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=eclipse-iceoryx)](https://app.codecov.io/gh/eclipse-iceoryx/iceoryx2/pull/117?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=eclipse-iceoryx) ```diff @@ Coverage Diff @@ ## main #117 +/- ## ======================================= Coverage 77.36% 77.36% ======================================= Files 181 181 Lines 19596 19598 +2 ======================================= + Hits 15160 15162 +2 Misses 4436 4436 ``` | [Files](https://app.codecov.io/gh/eclipse-iceoryx/iceoryx2/pull/117?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=eclipse-iceoryx) | Coverage Δ | | |---|---|---| | [iceoryx2/src/port/publisher.rs](https://app.codecov.io/gh/eclipse-iceoryx/iceoryx2/pull/117?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=eclipse-iceoryx#diff-aWNlb3J5eDIvc3JjL3BvcnQvcHVibGlzaGVyLnJz) | `83.33% <100.00%> (+0.10%)` | :arrow_up: |