Skip to content

[21355] Make on_xxx_matched thread-safe#6371

Merged
MiguelCompany merged 4 commits into
masterfrom
bugfix/21355
Apr 28, 2026
Merged

[21355] Make on_xxx_matched thread-safe#6371
MiguelCompany merged 4 commits into
masterfrom
bugfix/21355

Conversation

@MiguelCompany

@MiguelCompany MiguelCompany commented Apr 20, 2026

Copy link
Copy Markdown
Member

Description

This fixes a data race in the matched callbacks of the inner listeners in DataReaderImpl and DataWriterImpl.
The regression test does not always fail before the fix (but always fails for me with --repeat until-fail:100).
It always passes with the fix in place.

@Mergifyio backport 3.4.x 3.2.x 2.14.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
  • 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)
  • Changes are backport compatible: they do NOT break ABI nor change library core behavior.
  • 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.
  • 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.

@MiguelCompany MiguelCompany added this to the v3.6.1 - Frozen ❄️ milestone Apr 20, 2026
@MiguelCompany
MiguelCompany requested review from richiprosima and removed request for richiprosima April 20, 2026 07:56
@github-actions github-actions Bot added the ci-pending PR which CI is running label Apr 20, 2026
@MiguelCompany
MiguelCompany marked this pull request as ready for review April 20, 2026 13:28
@MiguelCompany MiguelCompany mentioned this pull request Apr 20, 2026
12 tasks
@emiliocuestaf emiliocuestaf removed the ci-pending PR which CI is running label Apr 20, 2026
@emiliocuestaf
emiliocuestaf self-requested a review April 20, 2026 13:40
@github-actions github-actions Bot added the ci-pending PR which CI is running label Apr 20, 2026
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
@MiguelCompany
MiguelCompany marked this pull request as draft April 21, 2026 08:13
@MiguelCompany
MiguelCompany requested review from cferreiragonz and removed request for cferreiragonz April 21, 2026 08:13
@MiguelCompany
MiguelCompany marked this pull request as ready for review April 21, 2026 08:14

@emiliocuestaf emiliocuestaf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@MiguelCompany
MiguelCompany merged commit de70d42 into master Apr 28, 2026
38 of 43 checks passed
@MiguelCompany
MiguelCompany deleted the bugfix/21355 branch April 28, 2026 14:22
@MiguelCompany

Copy link
Copy Markdown
Member Author

@Mergifyio backport 3.4.x 3.2.x 2.14.x

@mergify

mergify Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

backport 3.4.x 3.2.x 2.14.x

✅ Backports have been created

Details

Cherry-pick of de70d42 has failed:

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

You are currently cherry-picking commit de70d42f.
  (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/fastdds/publisher/DataWriterImpl.cpp
	modified:   src/cpp/fastdds/publisher/DataWriterImpl.hpp
	modified:   src/cpp/fastdds/subscriber/DataReaderImpl.cpp
	modified:   src/cpp/fastdds/subscriber/DataReaderImpl.hpp
	modified:   src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   test/blackbox/common/DDSBlackboxTestsDiscovery.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

Cherry-pick of de70d42 has failed:

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

You are currently cherry-picking commit de70d42f6.
  (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/fastdds/publisher/DataWriterImpl.cpp
	modified:   src/cpp/fastdds/publisher/DataWriterImpl.hpp
	modified:   src/cpp/fastdds/subscriber/DataReaderImpl.cpp
	modified:   src/cpp/fastdds/subscriber/DataReaderImpl.hpp
	modified:   src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   test/blackbox/common/DDSBlackboxTestsDiscovery.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

Cherry-pick of de70d42 has failed:

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

You are currently cherry-picking commit de70d42f6.
  (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/fastdds/publisher/DataWriterImpl.cpp
	modified:   src/cpp/fastdds/subscriber/DataReaderImpl.cpp
	modified:   src/cpp/fastdds/subscriber/DataReaderImpl.hpp

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   src/cpp/fastdds/publisher/DataWriterImpl.hpp
	both modified:   src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp
	both modified:   test/blackbox/common/DDSBlackboxTestsDiscovery.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 added a commit that referenced this pull request May 29, 2026
* Refs #21355. Added regression test.

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

* Refs #21355. Improve readability in EDP.cpp.

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

* Refs #21355. Protect `InnerDataWriterListener::on_writer_matched`.

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

* Refs #21355. Protect `InnerDataReaderListener::on_reader_matched`.

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

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
MiguelCompany added a commit that referenced this pull request May 29, 2026
* Refs #21355. Added regression test.

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

* Refs #21355. Improve readability in EDP.cpp.

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

* Refs #21355. Protect `InnerDataWriterListener::on_writer_matched`.

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

* Refs #21355. Protect `InnerDataReaderListener::on_reader_matched`.

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

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
MiguelCompany added a commit that referenced this pull request Jun 1, 2026
* Refs #21355. Added regression test.



* Refs #21355. Improve readability in EDP.cpp.



* Refs #21355. Protect `InnerDataWriterListener::on_writer_matched`.



* Refs #21355. Protect `InnerDataReaderListener::on_reader_matched`.



---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Co-authored-by: Miguel Company <miguelcompany@eprosima.com>
cferreiragonz pushed a commit that referenced this pull request Jul 13, 2026
* Refs #21355. Added regression test.

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

* Refs #21355. Improve readability in EDP.cpp.

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

* Refs #21355. Protect `InnerDataWriterListener::on_writer_matched`.

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

* Refs #21355. Protect `InnerDataReaderListener::on_reader_matched`.

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

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
(cherry picked from commit de70d42)

# Conflicts:
#	test/blackbox/common/DDSBlackboxTestsDiscovery.cpp
MiguelCompany added a commit that referenced this pull request Jul 13, 2026
* Make `on_xxx_matched` thread-safe (#6371)

* Refs #21355. Added regression test.

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

* Refs #21355. Improve readability in EDP.cpp.

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

* Refs #21355. Protect `InnerDataWriterListener::on_writer_matched`.

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

* Refs #21355. Protect `InnerDataReaderListener::on_reader_matched`.

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

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
(cherry picked from commit de70d42)

# Conflicts:
#	test/blackbox/common/DDSBlackboxTestsDiscovery.cpp

* Fix conflicts

Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com>

* Uncrustify

Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com>

---------

Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com>
Co-authored-by: Miguel Company <miguelcompany@eprosima.com>
Co-authored-by: Carlos Ferreira González <carlosferreira@eprosima.com>
cferreiragonz pushed a commit that referenced this pull request Jul 20, 2026
* Refs #21355. Added regression test.

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

* Refs #21355. Improve readability in EDP.cpp.

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

* Refs #21355. Protect `InnerDataWriterListener::on_writer_matched`.

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

* Refs #21355. Protect `InnerDataReaderListener::on_reader_matched`.

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

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
(cherry picked from commit de70d42)

# Conflicts:
#	src/cpp/fastdds/publisher/DataWriterImpl.hpp
#	src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp
#	test/blackbox/common/DDSBlackboxTestsDiscovery.cpp
cferreiragonz pushed a commit that referenced this pull request Jul 20, 2026
* Refs #21355. Added regression test.

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

* Refs #21355. Improve readability in EDP.cpp.

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

* Refs #21355. Protect `InnerDataWriterListener::on_writer_matched`.

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

* Refs #21355. Protect `InnerDataReaderListener::on_reader_matched`.

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

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
(cherry picked from commit de70d42)
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 fast dds pro

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants