Skip to content

[21670] Avoid Data Race in Reader Locator#5833

Merged
MiguelCompany merged 2 commits intomasterfrom
fix_router_tsan_domain_mutex
May 30, 2025
Merged

[21670] Avoid Data Race in Reader Locator#5833
MiguelCompany merged 2 commits intomasterfrom
fix_router_tsan_domain_mutex

Conversation

@cferreiragonz
Copy link
Copy Markdown
Contributor

@cferreiragonz cferreiragonz commented May 28, 2025

Description

This PR modifies find_local_reader method to assign the local_reader shared pointer within the function, instead of returning the value. In this way, all operations are protected by the RTPSDomain mutex and no data race can occur.

This Data Race is reported by DDS Router CI.

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.
  • N/A Any new configuration API has an equivalent XML API (with the corresponding XSD extension)
  • N/A Changes are backport compatible: they do NOT break ABI nor change library core behavior.
  • N/A 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.
  • N/A 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.
  • If this is a critical bug fix, backports to the critical-only supported branches have been requested.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>
@cferreiragonz cferreiragonz added this to the v3.2.3 milestone May 28, 2025
@github-actions github-actions Bot added the ci-pending PR which CI is running label May 28, 2025
@cferreiragonz cferreiragonz removed the request for review from richiprosima May 28, 2025 12:13
Comment thread src/cpp/rtps/RTPSDomainImpl.hpp Outdated
Comment thread src/cpp/rtps/RTPSDomain.cpp Outdated
Comment thread test/mock/rtps/RTPSDomainImpl/rtps/RTPSDomainImpl.hpp Outdated
Comment thread test/mock/rtps/RTPSParticipantImpl/rtps/participant/RTPSParticipantImpl.hpp Outdated
Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>
@cferreiragonz cferreiragonz requested review from richiprosima and removed request for richiprosima May 28, 2025 13:09
Copy link
Copy Markdown
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.

LGTM with green CI.

We'll need a careful look at the TSAN logs from the nightly and this PR to verify that the data race has disappeared.

@cferreiragonz
Copy link
Copy Markdown
Contributor Author

@richiprosima test style pls

@MiguelCompany
Copy link
Copy Markdown
Member

Number of data races reported by TSAN:

@MiguelCompany
Copy link
Copy Markdown
Member

@Mergifyio backport 3.1.x 2.14.x

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 30, 2025

backport 3.1.x 2.14.x

✅ Backports have been created

Details

@MiguelCompany MiguelCompany merged commit e15acec into master May 30, 2025
16 of 17 checks passed
@MiguelCompany MiguelCompany deleted the fix_router_tsan_domain_mutex branch May 30, 2025 07:39
mergify Bot pushed a commit that referenced this pull request May 30, 2025
* Refs #21670: Avoid Data Race in Reader Locator

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #21670: Apply review

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

---------

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>
(cherry picked from commit e15acec)
mergify Bot pushed a commit that referenced this pull request May 30, 2025
* Refs #21670: Avoid Data Race in Reader Locator

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #21670: Apply review

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

---------

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>
(cherry picked from commit e15acec)

# Conflicts:
#	test/mock/rtps/RTPSDomainImpl/rtps/RTPSDomainImpl.hpp
MiguelCompany pushed a commit that referenced this pull request Jun 5, 2025
* Refs #21670: Avoid Data Race in Reader Locator



* Refs #21670: Apply review



---------


(cherry picked from commit e15acec)

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>
Co-authored-by: Carlos Ferreira González <carlosferreira@eprosima.com>
cferreiragonz added a commit that referenced this pull request Jun 17, 2025
* Avoid Data Race in Reader Locator (#5833)

* Refs #21670: Avoid Data Race in Reader Locator

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #21670: Apply review

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

---------

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>
(cherry picked from commit e15acec)

# Conflicts:
#	test/mock/rtps/RTPSDomainImpl/rtps/RTPSDomainImpl.hpp

* Fix conflicts

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Fix namespace conflict

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>
Co-authored-by: Carlos Ferreira González <carlosferreira@eprosima.com>
Co-authored-by: Miguel Company <miguelcompany@eprosima.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-pending PR which CI is running

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants