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

[20227] Prevent index overflow and correctly assert the end iterator in DataSharing #4321

Merged
merged 6 commits into from
Feb 20, 2024

Conversation

Mario-DL
Copy link
Member

@Mario-DL Mario-DL commented Jan 29, 2024

Description

When a DataSharing compatible publisher and subscriber were launched at high frequency (publication interval set to 0), it happened two different issues:

  • The current notified_end of the segment iterator was being updated before being actually checked, making an assert() compare two different versions of this iterator.
  • On the other hand, unrelated with the previous observation, a corner case of advancing twice the next_payload_ counter could occur.

Apart from the included test, in order to reproduce the first issue it is enough to launch a BasicConfigurationExample with a bounded type and no sleep betweenwrites(). Launching, killing and relaunching the subscriber should trigger the assertion.
For reproducing the second issue, launch the subscriber first and then the publisher, a SIGSEV will be triggered in 20 seconds or so.

This PR includes two fixes that mitigate the problem.
The idea of the test is that if in 20 seconds we have not crashed by some of the above issues, we give the test as passed.

Important note It was noticed that enabling all the verbosity messages in the test, makes the test not work properly under colcon since the timeout notification of the SubscriberModule.cpp condition variable is never fired. It seems that the test stresses the cpu and the timeout notification is lost. However, if the python3 is directly invoked from a terminal (outside colcon), then there is no problem even if all the logs are enabled.

@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.
  • 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.
  • [X ] 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.

@Mario-DL Mario-DL added the ci-pending PR which CI is running label Jan 29, 2024
@Mario-DL Mario-DL added this to the v2.13.2 milestone Jan 29, 2024
@Mario-DL
Copy link
Member Author

@richiprosima please test linux

@Mario-DL
Copy link
Member Author

@richiprosima please test mac

@Mario-DL
Copy link
Member Author

@richiprosima please test discovery_server

@Mario-DL
Copy link
Member Author

@richiprosima please test mac

@EduPonz EduPonz modified the milestones: v2.13.2, v2.13.3 Feb 1, 2024
Copy link

@EduPonz EduPonz left a comment

Choose a reason for hiding this comment

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

NIT not requiring CI

test/dds/communication/SubscriberMain.cpp Show resolved Hide resolved
Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
@Mario-DL
Copy link
Member Author

@richiprosima please test this

@EduPonz
Copy link

EduPonz commented Feb 16, 2024

@richiprosima please test mac

7 similar comments
@Mario-DL
Copy link
Member Author

@richiprosima please test mac

@Mario-DL
Copy link
Member Author

@richiprosima please test mac

@Mario-DL
Copy link
Member Author

@richiprosima please test mac

@Mario-DL
Copy link
Member Author

@richiprosima please test mac

@EduPonz
Copy link

EduPonz commented Feb 19, 2024

@richiprosima please test mac

@Mario-DL
Copy link
Member Author

@richiprosima please test mac

@Mario-DL
Copy link
Member Author

@richiprosima please test mac

@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 Feb 20, 2024
@JesusPoderoso
Copy link
Contributor

CI issues unrelated to the PR. Ready to merge!

@MiguelCompany MiguelCompany merged commit 66de89e into master Feb 20, 2024
16 of 21 checks passed
@MiguelCompany MiguelCompany deleted the bugfix/20227 branch February 20, 2024 08:13
@MiguelCompany
Copy link
Member

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

Copy link
Contributor

mergify bot commented Feb 20, 2024

mergify bot pushed a commit that referenced this pull request Feb 20, 2024
…haring (#4321)

* Refs #20227: Add DDS communication test

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

* Refs #20227: Prevent history index to overflow history size

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

* Refs #20227: Correctly assert the current end

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

* Refs #20227: Linter

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

* Refs #20227: Initialize test timeout argument properly

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

* Refs #20227: Rev suggestion

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

---------

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
(cherry picked from commit 66de89e)
mergify bot pushed a commit that referenced this pull request Feb 20, 2024
…haring (#4321)

* Refs #20227: Add DDS communication test

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

* Refs #20227: Prevent history index to overflow history size

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

* Refs #20227: Correctly assert the current end

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

* Refs #20227: Linter

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

* Refs #20227: Initialize test timeout argument properly

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

* Refs #20227: Rev suggestion

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

---------

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
(cherry picked from commit 66de89e)
MiguelCompany pushed a commit that referenced this pull request Feb 21, 2024
…haring (#4321) (#4403)

* Refs #20227: Add DDS communication test

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

* Refs #20227: Prevent history index to overflow history size

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

* Refs #20227: Correctly assert the current end

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

* Refs #20227: Linter

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

* Refs #20227: Initialize test timeout argument properly

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

* Refs #20227: Rev suggestion

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

---------

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

Co-authored-by: Mario Domínguez López <116071334+Mario-DL@users.noreply.github.com>
Mario-DL added a commit that referenced this pull request Feb 23, 2024
…haring (#4321)

* Refs #20227: Add DDS communication test

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

* Refs #20227: Prevent history index to overflow history size

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

* Refs #20227: Correctly assert the current end

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

* Refs #20227: Linter

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

* Refs #20227: Initialize test timeout argument properly

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

* Refs #20227: Rev suggestion

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

---------

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
MiguelCompany pushed a commit that referenced this pull request Mar 1, 2024
…haring (#4321) (#4404)

* Refs #20227: Add DDS communication test



* Refs #20227: Prevent history index to overflow history size



* Refs #20227: Correctly assert the current end



* Refs #20227: Linter



* Refs #20227: Initialize test timeout argument properly



* Refs #20227: Rev suggestion



---------

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
Co-authored-by: Mario Domínguez López <116071334+Mario-DL@users.noreply.github.com>
EduPonz pushed a commit that referenced this pull request Mar 12, 2024
…haring (#4321) (#4402)

* Refs #20227: Add DDS communication test

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

* Refs #20227: Prevent history index to overflow history size

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

* Refs #20227: Correctly assert the current end

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

* Refs #20227: Linter

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

* Refs #20227: Initialize test timeout argument properly

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

* Refs #20227: Rev suggestion

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

---------

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

Co-authored-by: Mario Domínguez López <116071334+Mario-DL@users.noreply.github.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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants