Fast-DDS icon indicating copy to clipboard operation
Fast-DDS copied to clipboard

Update enable order of RTPSParticipantImpl

Open Yankefei opened this issue 3 weeks ago • 1 comments

Description

When I was researching fast-dds initialization, I discovered a small bug

12-01-2

Some of the first few udp messages were not processed, and it seems that they were not executed here。message_receiver()->OnDataReceived image image

In the end, I found out that the receiver here was not initialized。 The processing thread for UDP messages starts in the constructor of UDPChannelResource during the mp_builtinProtocols->enable() phase, but the initialization of the receiver occurs after the thread starts: image

Some printed logs are as follows: image 0x79e5ede00640 == 134028445353536

In summary, it seems that in mp_builtinProtocols->enable(), a UDP message processing thread was created and quickly began receiving data. However, the receiver pointer for the processing part was not ready, so the first three messages were discarded

Since the number of m_receiverResourcelist did not change during mp_builtinProtocols->enable(), I attempted to adjust the position of enable and verified that this issue can be resolved. image

The adjustment here may have a significant impact :), please evaluate whether this modification is feasible, Thanks~

@Mergifyio backport 3.3.x 3.2.x 2.14.x

Contributor Checklist

  • [x] Commit messages follow the project guidelines.
  • [x] 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)
  • [x] Changes are backport compatible: they do NOT break ABI nor change library core behavior.
  • [x] 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

  • [x] The PR has a milestone assigned.
  • [x] The title and description correctly express the PR's purpose.
  • [x] Check contributor checklist is correct.
  • [x] If this is a critical bug fix, backports to the critical-only supported branches have been requested.
  • [x] Check CI results: changes do not issue any warning.
  • [x] Check CI results: failing tests are unrelated with the changes.

Yankefei avatar Dec 01 '25 13:12 Yankefei