Skip to content

Conversation

@Yankefei
Copy link

@Yankefei Yankefei commented Dec 1, 2025

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

  • 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)
  • 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.
  • [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.

@Yankefei Yankefei marked this pull request as ready for review December 1, 2025 15:39
@Yankefei
Copy link
Author

Yankefei commented Dec 1, 2025

The thread_id in the std::cout started as decimal and then became hexadecimal because I used std::hex and didn't restore it...

@Yankefei Yankefei marked this pull request as draft December 30, 2025 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant