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

[20276] Discard already processed samples on PDPListener #4268

Merged
merged 3 commits into from
Jan 24, 2024

Conversation

EduPonz
Copy link

@EduPonz EduPonz commented Jan 22, 2024

Description

This PR fixes a datarace in PDPListener that was causing assertions on Windows Debug. Prior to this PR, if a DATA(P) of an already discovered participant was received through multicast (the sample has already been processed since the data is the just the periodic announcement of the remote participant) while a DATA(uP) (or an update changing locators) is being processed on one of the metta-traffic unicast reception threads, then processing the DATA(P) could segfault while iterating over a collection of locators that the DATA(uP) processing has already deleted.

This PR fixes that data race by avoiding processing a sample which has already been processed, thus avoiding re-processing of periodic announcements.

@Mergifyio backport 2.12.x 2.11.x 2.10.x 2.6.x

Contributor Checklist

  • Commit messages follow the project guidelines.
  • The code follows the style guidelines of this project.
  • N/A: 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
  • N/A: Any new/modified methods have been properly documented using Doxygen.
  • Changes are ABI compatible.
  • Changes are API compatible.
  • N/A: New feature has been added to the versions.md file (if applicable).
  • N/A: New feature has been documented/Current behavior is correctly described in the documentation.
  • Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • The title and description correctly express the PR's purpose.
  • Check contributor checklist is correct.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

@EduPonz EduPonz added this to the v2.13.2 milestone Jan 22, 2024
@EduPonz
Copy link
Author

EduPonz commented Jan 22, 2024

@Mergifyio backport 2.12.x 2.11.x 2.10.x 2.6.x

Copy link
Contributor

mergify bot commented Jan 22, 2024

backport 2.12.x 2.11.x 2.10.x 2.6.x

✅ Backports have been created

@JesusPoderoso JesusPoderoso added the ci-pending PR which CI is running label Jan 22, 2024
Signed-off-by: EduPonz <eduardoponz@eprosima.com>
@EduPonz EduPonz changed the title [20276] Synchronize calls to PDPListener::onNewCacheChangeAdded [20276] Discard already processed samples on PDPListener Jan 22, 2024
@EduPonz
Copy link
Author

EduPonz commented Jan 22, 2024

@richiprosima please test this

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
@EduPonz
Copy link
Author

EduPonz commented Jan 23, 2024

@richiprosima please test this

@EduPonz
Copy link
Author

EduPonz commented Jan 23, 2024

@richiprosima please test mac test windows

1 similar comment
@EduPonz
Copy link
Author

EduPonz commented Jan 24, 2024

@richiprosima please test mac test windows

Copy link
Member

@MiguelCompany MiguelCompany left a comment

Choose a reason for hiding this comment

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

Just one nit which does not require to re-run CI

src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp Outdated Show resolved Hide resolved
Signed-off-by: EduPonz <eduardoponz@eprosima.com>
@EduPonz EduPonz added skip-ci Automatically pass CI and removed ci-pending PR which CI is running labels Jan 24, 2024
@MiguelCompany MiguelCompany added the ready-to-merge Ready to be merged. CI and changes have been reviewed and approved. label Jan 24, 2024
@EduPonz EduPonz merged commit 4864393 into master Jan 24, 2024
7 checks passed
@EduPonz EduPonz deleted the hotfix/pdp_datarace branch January 24, 2024 08:05
mergify bot pushed a commit that referenced this pull request Jan 24, 2024
* Refs #20276: Discard processing already processed samples on PDPListener

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20276: Fix failing tests

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20276: Address Miguel's comments

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

---------

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
(cherry picked from commit 4864393)
mergify bot pushed a commit that referenced this pull request Jan 24, 2024
* Refs #20276: Discard processing already processed samples on PDPListener

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20276: Fix failing tests

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20276: Address Miguel's comments

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

---------

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
(cherry picked from commit 4864393)
mergify bot pushed a commit that referenced this pull request Jan 24, 2024
* Refs #20276: Discard processing already processed samples on PDPListener

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20276: Fix failing tests

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20276: Address Miguel's comments

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

---------

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
(cherry picked from commit 4864393)
mergify bot pushed a commit that referenced this pull request Jan 24, 2024
* Refs #20276: Discard processing already processed samples on PDPListener

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20276: Fix failing tests

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20276: Address Miguel's comments

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

---------

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
(cherry picked from commit 4864393)
EduPonz added a commit that referenced this pull request Jan 25, 2024
* Refs #20276: Discard processing already processed samples on PDPListener

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20276: Fix failing tests

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20276: Address Miguel's comments

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

---------

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
(cherry picked from commit 4864393)

Co-authored-by: Eduardo Ponz Segrelles <eduardoponz@eprosima.com>
EduPonz added a commit that referenced this pull request Jan 26, 2024
* Refs #20276: Discard processing already processed samples on PDPListener

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20276: Fix failing tests

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20276: Address Miguel's comments

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

---------

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
(cherry picked from commit 4864393)

Co-authored-by: Eduardo Ponz Segrelles <eduardoponz@eprosima.com>
EduPonz added a commit that referenced this pull request Jan 27, 2024
* Refs #20276: Discard processing already processed samples on PDPListener

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20276: Fix failing tests

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20276: Address Miguel's comments

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

---------

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
(cherry picked from commit 4864393)

Co-authored-by: Eduardo Ponz Segrelles <eduardoponz@eprosima.com>
Mario-DL pushed a commit that referenced this pull request Mar 19, 2024
* Refs #20276: Discard processing already processed samples on PDPListener

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20276: Fix failing tests

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20276: Address Miguel's comments

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

---------

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
(cherry picked from commit 4864393)
EduPonz added a commit that referenced this pull request Mar 26, 2024
* Refs #20276: Discard processing already processed samples on PDPListener

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20276: Fix failing tests

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

* Refs #20276: Address Miguel's comments

Signed-off-by: EduPonz <eduardoponz@eprosima.com>

---------

Signed-off-by: EduPonz <eduardoponz@eprosima.com>
(cherry picked from commit 4864393)

Co-authored-by: Eduardo Ponz Segrelles <eduardoponz@eprosima.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Ready to be merged. CI and changes have been reviewed and approved. skip-ci Automatically pass CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants