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

[21065] Bugfix: correct liveliness state in a multiple reader - one writer scenario (backport #4822) #4882

Merged
merged 2 commits into from
Jun 6, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented May 31, 2024

Description

This PR corrects a misbehavior given in a single writer - multiple readers scenario. When the writer is destroyed, the WriterProxy is removed from readers. When it is removed from the first one, the LivelinessManager::remove_writer() returns false as --writer.count is 1, hence the liveliness_changed callback is not triggered (callback_ within LivelinessManager is not invoked). When the WriterProxy is deleted from the second reader, the LivelinessManager::remove_writer() correctly removes the writer and fires the callback. The problem in this case is that, later, in WLP::sub_liveliness_changed() the update_liveliness_changed_status() is only called for this later reader, since the first one is not matched anymore and reader->matched_writer_is_matched() returns false, corrupting its liveliness state. In this situation, if the writer wakes up again, the first reader is going to return an alive_count of 2 instead of 1.

The fix proposes that every time we unpair a WriterProxy from a reader, we should also update the liveliness state for that particular reader. The solution tries to avoid defining extra collections for tracking readers/writers.

@Mergifyio backport 2.14.x 2.13.x 2.10.x 2.6.x

Fixes #4610

Contributor Checklist

  • Commit messages follow the project guidelines.

  • The code follows the style guidelines of this project.

  • 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

  • Any new/modified methods have been properly documented using Doxygen.

  • NO Any new configuration API has an equivalent XML API (with the corresponding XSD extension)

  • Changes are backport compatible: they do NOT break ABI nor change library core behavior.

  • Changes are API compatible.

  • NO New feature has been added to the versions.md file (if applicable).

  • NO 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.

This is an automatic backport of pull request #4822 done by [Mergify](https://mergify.com).

…s on the same topic (#4822)

* Refs #21065: Add BB test

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #21065: Add fix rework after sync with Miguel

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* REfs #21065: Correct windows NIT

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #21065: Apply NIT

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

---------

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
(cherry picked from commit df90943)

# Conflicts:
#	include/fastdds/rtps/writer/LivelinessManager.h
#	src/cpp/rtps/writer/LivelinessManager.cpp
#	test/unittest/rtps/writer/LivelinessManagerTests.cpp
Copy link
Contributor Author

mergify bot commented May 31, 2024

Cherry-pick of df90943 has failed:

On branch mergify/bp/2.13.x/pr-4822
Your branch is up to date with 'origin/2.13.x'.

You are currently cherry-picking commit df909438f.
  (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/builtin/liveliness/WLP.cpp
	modified:   src/cpp/rtps/reader/StatefulReader.cpp
	modified:   src/cpp/rtps/reader/StatelessReader.cpp
	modified:   test/blackbox/common/BlackboxTestsLivelinessQos.cpp

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   include/fastdds/rtps/writer/LivelinessManager.h
	both modified:   src/cpp/rtps/writer/LivelinessManager.cpp
	both modified:   test/unittest/rtps/writer/LivelinessManagerTests.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

@mergify mergify bot added the conflicts Backport PR wich git cherry pick failed label May 31, 2024
@MiguelCompany MiguelCompany added this to the v2.13.5 milestone May 31, 2024
Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
@Mario-DL Mario-DL requested a review from JesusPoderoso June 4, 2024 08:31
@Mario-DL Mario-DL removed the conflicts Backport PR wich git cherry pick failed label Jun 4, 2024
@Mario-DL Mario-DL requested review from JesusPoderoso and removed request for JesusPoderoso June 4, 2024 08:31
@github-actions github-actions bot added the ci-pending PR which CI is running label Jun 4, 2024
@JesusPoderoso
Copy link
Contributor

@richiprosima please test this

@JesusPoderoso JesusPoderoso mentioned this pull request Jun 5, 2024
7 tasks
Copy link
Contributor

@JesusPoderoso JesusPoderoso left a comment

Choose a reason for hiding this comment

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

LGTM

@JesusPoderoso JesusPoderoso added ready-to-merge Ready to be merged. CI and changes have been reviewed and approved. and removed ci-pending PR which CI is running labels Jun 5, 2024
@MiguelCompany MiguelCompany merged commit 2d76b04 into 2.13.x Jun 6, 2024
19 of 20 checks passed
@MiguelCompany MiguelCompany deleted the mergify/bp/2.13.x/pr-4822 branch June 6, 2024 14:28
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants