Skip to content

[24121] Account for notification sample in DataReaderHistory::get_first_untaken_info#6276

Merged
MiguelCompany merged 5 commits into3.4.xfrom
bugfix/24120/3.4.x
Jan 27, 2026
Merged

[24121] Account for notification sample in DataReaderHistory::get_first_untaken_info#6276
MiguelCompany merged 5 commits into3.4.xfrom
bugfix/24120/3.4.x

Conversation

@MiguelCompany
Copy link
Member

@MiguelCompany MiguelCompany commented Jan 26, 2026

Description

When using get_first_untaken_info to check whether a DataReader has a sample to be taken, the fake sample introduced in #5943 should be taken into account.

Otherwise, as noted in ros2/rclcpp#3036, the application may enter an infinite loop in which a WaitSet waiting in the DataReader's StatusCondition never blocks, and get_first_untaken_info never returns OK, causing 100% CPU usage.

NOTE: Opening against 3.4.x so the issue in ROS 2 is quickly fixed, so requesting a forward port to master

@Mergifyio backport master

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.

Copy link
Contributor

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

the fake sample should be taken into account with this PR to avoid an infinite loop in which a WaitSet waiting on the DataReader's StatusCondition never blocks, and eventually causing 100% CPU usage.

@MiguelCompany thanks for the PR 🚀 we also need to backport to kilted, correct?

https://github.com/ros2/ros2/blob/kilted/ros2.repos#L34-L37

@MiguelCompany
Copy link
Member Author

we also need to backport to kilted, correct?

I don't think so, since the backport of #5943 into 3.2.x (#5956) was reverted in #5968

@fujitatomoya
Copy link
Contributor

oh i missed that backport... thanks!

Copy link
Contributor

@emiliocuestaf emiliocuestaf 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

…est.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Moving code to a public static method so it can be used outside.

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

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 requested review from richiprosima and removed request for richiprosima January 26, 2026 15:52
@mergify
Copy link
Contributor

mergify bot commented Jan 27, 2026

🧪 CI Insights

Here's what we observed from your CI run for 0496072.

❌ Job Failures

Pipeline Job Health on 3.4.x Retries 🔍 CI Insights 📄 Logs
Fast DDS MacOS CI mac-ci / fastdds_test () Unknown 0 View View
Fast DDS Windows CI windows-ci / fastdds_test (RelWithDebInfo, examples), v143 Unknown 1 View View

@MiguelCompany MiguelCompany merged commit 0096d75 into 3.4.x Jan 27, 2026
35 of 38 checks passed
@MiguelCompany MiguelCompany deleted the bugfix/24120/3.4.x branch January 27, 2026 05:49
@MiguelCompany
Copy link
Member Author

@Mergifyio backport master

@mergify
Copy link
Contributor

mergify bot commented Jan 27, 2026

backport master

✅ Backports have been created

Details

mergify bot pushed a commit that referenced this pull request Jan 27, 2026
…ken_info` (#6276)

* Refs #24120. Extend `return_sample_when_writer_disappears` blackbox test.

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

* Refs #24120. Refactor `ReadTakeCommand::generate_info`.

Moving code to a public static method so it can be used outside.

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

* Refs #24120. Account for notification sample in `DataReaderHistory::get_first_untaken_info`.

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

* Refs #24121. Please uncrustify.

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

* Refs #24121. Fix build error.

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

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
(cherry picked from commit 0096d75)
MiguelCompany added a commit that referenced this pull request Jan 27, 2026
…ken_info` (#6276) (#6278)

* Refs #24120. Extend `return_sample_when_writer_disappears` blackbox test.



* Refs #24120. Refactor `ReadTakeCommand::generate_info`.

Moving code to a public static method so it can be used outside.



* Refs #24120. Account for notification sample in `DataReaderHistory::get_first_untaken_info`.



* Refs #24121. Please uncrustify.



* Refs #24121. Fix build error.



---------


(cherry picked from commit 0096d75)

Signed-off-by: Miguel Company <miguelcompany@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.

3 participants