Skip to content

Fix EventsCBGExecutor spin_some and spin_all(0) executing only one entity - #3415

Merged
skyegalaxy merged 1 commit into
ros2:rollingfrom
mini-1235:fix-events-cbg-spin-some
Nov 17, 2026
Merged

skyegalaxy merged 1 commit into
ros2:rollingfrom
mini-1235:fix-events-cbg-spin-some

Conversation

@mini-1235

Copy link
Copy Markdown
Contributor

Description

EventsCBGExecutor::spin_some() and spin_all(0) executed one ready entity per call, and an entity added after its callback group needed up to three spin_some() calls before it was served.

Both changes are in collect_and_execute_ready_events():

  • A max_duration of 0 now means no time limit, as in Executor::spin_some_impl(). Before, the deadline was start + 0, so the loop stopped after the first entity.
  • If the executed work requested a callback group resync, spin_some() resyncs and collects once more instead of returning. Before, the resync only ran at the start of the next call.

Fixes #3414

Is this user-facing behavior change?

Yes. One spin_some() call now executes all events that were ready when it was called, and spin_all(0) runs until no work is left.

spin_some() can execute the same entity several times in one call, once per event that was queued at the start, like rclcpp::experimental::executors::EventsExecutor. The wait-set executors execute an entity once per call.

Did you use Generative AI?

Yes, Claude Fable 5.2

Additional Information

…tity

collect_and_execute_ready_events() computed the deadline as
start + max_duration. With a max_duration of 0, which means no limit, the
deadline had already passed, so spin_some() and spin_all(0) returned after
the first executed entity. Treat 0 as no time limit, as
Executor::spin_some_impl() does.

An entity that was added after its callback group needed up to three
spin_some() calls before it was served: executing the notify guard
condition event requests the sync, executing the sync function only sets
needs_callback_group_resync, and the resync ran at the start of the next
call. If the executed work requested a resync, resync and collect once
more instead of returning.

Add a test that several ready waitables are all executed by one
spin_some() and one spin_all(0), and enable the spin_some warm-up tests
for the EventsCBGExecutor.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
@mini-1235

mini-1235 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor Author

So I noticed that the spin_some_doesnt_require_warmup* tests are skipped for EventsCBGExecutor, which I think would have caught this issue. I also did another scan with AI and found a few more tests that are disabled for EventsCBGExecutor. I will open a separate PR to enable them: #3416

@mini-1235 mini-1235 changed the title Fix EventsCBGExecutor spin_some and spin_all(0) executing only one en… Fix EventsCBGExecutor spin_some and spin_all(0) executing only one entity Nov 16, 2026
@github-actions

Copy link
Copy Markdown

ABI Compliance Check

✅ Verdict: compatible

Library Verdict Summary
libcomponent_manager.so ✅ compatible No ABI changes detected.
librclcpp.so ✅ compatible No ABI changes detected.
librclcpp_action.so ✅ compatible No ABI changes detected.
librclcpp_lifecycle.so ✅ compatible No ABI changes detected.
✅ libcomponent_manager.so — full abidiff report

Compared:

  • Base: lib-base/libcomponent_manager.so
  • Head: lib-pr/libcomponent_manager.so @ 2a44dee
(empty report — no differences printed by abidiff)
✅ librclcpp.so — full abidiff report

Compared:

  • Base: lib-base/librclcpp.so
  • Head: lib-pr/librclcpp.so @ 2a44dee
(empty report — no differences printed by abidiff)
✅ librclcpp_action.so — full abidiff report

Compared:

  • Base: lib-base/librclcpp_action.so
  • Head: lib-pr/librclcpp_action.so @ 2a44dee
(empty report — no differences printed by abidiff)
✅ librclcpp_lifecycle.so — full abidiff report

Compared:

  • Base: lib-base/librclcpp_lifecycle.so
  • Head: lib-pr/librclcpp_lifecycle.so @ 2a44dee
(empty report — no differences printed by abidiff)

Updated for commit 2a44dee · check run · suppressions: /home/runner/work/_temp/ros2-abi-suppressions.txt

@skyegalaxy

Copy link
Copy Markdown
Member

Pulls: #3415
Gist: https://gist.githubusercontent.com/skyegalaxy/8f41f8f200303c6a2adda7cd08df6084/raw/77d80045f8b89ffbde75abff3ae399932cd01558/ros2.repos
BUILD args: --packages-above-and-dependencies rclcpp
TEST args: --packages-above rclcpp
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/21125

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@skyegalaxy
skyegalaxy merged commit 2424b75 into ros2:rolling Nov 17, 2026
11 checks passed
@skyegalaxy

Copy link
Copy Markdown
Member

@Mergifyio backport jazzy kilted lyrical

@mergify

mergify Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

backport jazzy kilted lyrical

✅ Backports have been created

Details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EventsCBGExecutor::spin_some() and spin_all(0) execute only one ready entity per call

3 participants