[20701] Enforce SHM ports open mode exclusions (backport #4635)
Description
As originally reported in #4504 a port could be open first with ReadShared and then with ReadExclusive the internal state of the port was incorrectly changed. This meant that the same port could be used at the same time for unicast and multicast.
This PR fixes #4634 by checking incompatibilities inside lock_read_exlcusive / lock_read_shared methods of the Port class.
@Mergifyio backport 2.13.x 2.10.x 2.6.x
Contributor Checklist
-
[x] Commit messages follow the project guidelines.
-
[x] The code follows the style guidelines of this project.
-
[x] Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally
-
[x] Any new/modified methods have been properly documented using Doxygen.
-
[x] Changes are ABI compatible.
-
[x] Changes are API compatible.
-
N/A New feature has been added to the
versions.mdfile (if applicable). -
N/A New feature has been documented/Current behavior is correctly described in the documentation.
-
[x] Applicable backports have been included in the description.
Reviewer Checklist
- [x] The PR has a milestone assigned.
- [x] The title and description correctly express the PR's purpose.
- [x] Check contributor checklist is correct.
- [x] Check CI results: changes do not issue any warning.
- [x] Check CI results: failing tests are unrelated with the changes.
This is an automatic backport of pull request #4635 done by [Mergify](https://mergify.com).
Cherry-pick of 3d159dc8c0e50902c24cbdc51a649d1f4de58e6a has failed:
On branch mergify/bp/2.6.x/pr-4635
Your branch is up to date with 'origin/2.6.x'.
You are currently cherry-picking commit 3d159dc8c.
(fix conflicts and run "git cherry-pick --continue")
(use "git cherry-pick --skip" to skip this patch)
(use "git cherry-pick --abort" to cancel the cherry-pick operation)
Changes to be committed:
modified: src/cpp/rtps/transport/shared_mem/SharedMemGlobal.hpp
modified: test/unittest/transport/SharedMemTests.cpp
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: test/blackbox/common/BlackboxTestsTransportSHM.cpp
To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally
@MiguelCompany would you mind addressing the conflicts here ?
@MiguelCompany Friendly ping here
@richiprosima please test this
Internally agree to close this PR