Repository navigation
jazzy: honor cancel() issued before spin() (backport ros2/rclcpp#3174) + sync with upstream jazzy 28.1.22 - #5
Merged
Conversation
(cherry picked from commit 45aef03) Signed-off-by: Janosch Machowinski <JMachowinski@cellumation.com> Signed-off-by: Marco A. Gutierrez <marcogg@marcogg.com> Co-authored-by: Janosch Machowinski <jmachowinski@users.noreply.github.com> Co-authored-by: Janosch Machowinski <JMachowinski@cellumation.com>
Signed-off-by: Marco A. Gutierrez <marcogg@marcogg.com>
Signed-off-by: Skyler Medeiros <skye@polymathrobotics.com> Co-authored-by: Skyler Medeiros <skye@polymathrobotics.com>
…BGExecutor scheduler (ros2#3234) (ros2#3236) * put in_queue under ready_callback_groups_mutex * only remove from ready_callback_groups if in the queue --------- (cherry picked from commit 4528e3c) Signed-off-by: Skyler Medeiros <skye@polymathrobotics.com> Co-authored-by: Skyler Medeiros <skye.galaxy@proton.me> Co-authored-by: Skyler Medeiros <skye@polymathrobotics.com>
Signed-off-by: Skyler Medeiros <skye@polymathrobotics.com> Co-authored-by: Skyler Medeiros <skye@polymathrobotics.com>
* honor cancel() issued before spin_until_future_complete(). Signed-off-by: Tomoya Fujita <tomoya.fujita825@gmail.com> * is_spinning() returns false immediately after cancel() even though the executor is still executing work. Signed-off-by: Tomoya Fujita <fujita.tomoya@triorb.co.jp> --------- Signed-off-by: Tomoya Fujita <tomoya.fujita825@gmail.com> Signed-off-by: Tomoya Fujita <fujita.tomoya@triorb.co.jp> (cherry picked from commit a67972f)
Jazzy still ships the StaticSingleThreadedExecutor (removed on rolling), so upstream ros2#3174 does not touch it. Apply the same cancel_requested_ handling here: a cancel issued before spin() is held until the next spin consumes it, and the spin loops react to cancel_requested_ only. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQ4WGjY7nv1dR8zbyjipqY
…r-cancel-before-spin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Executor::cancel()on jazzy only storesspinning = false. Acancel()issued before the spin thread has enteredspin()is lost:spin()then setsspinning = trueand runs until the process is killed.tf2_ros::TransformListener::~TransformListener()does exactlyexecutor_->cancel(); dedicated_listener_thread_->join();. Any node that owns aTransformListenerand is destroyed shortly after construction (every gtest fixture that builds a node per test) can therefore hang forever in its destructor. This is what timed outamr_navigationtest_swarm_planningin deep_cv drone build 76336: last log line, then 57 s of silence until ctest killed it.Standalone reproducer against the current
jazzy-updated(cancel, then spin in a thread, wait 3 s):What
a67972f3, rolling only):cancel()sets a heldcancel_requested_flag that the next spin consumes; the spin loops react to that flag only, andspinningis owned by the spin functions sois_spinning()stays true until a spin really returns. Conflicts were the jazzyExecutor(Context)initializer list and the(void)this_thread_numberline inMultiThreadedExecutor::run.StaticSingleThreadedExecutor, which jazzy still ships and upstream no longer patches.ros2/rclcppjazzy(28.1.22, 11 commits: reentrant callback groups for the events CBG executor and its scheduler race fix, context shutdown race, shutdown callback registration without the shutdown mutex, malformedset_parametersrequest hardening, ComponentManager executor-association check, MSVC compile fixes, changelogs). Clean merge, no conflicts; the fork's own commits (events executor default,matches_any_publishers()lookup, backward-ros, action expiry fixes) are untouched.Verified
cancelBeforeSpinDoesNotHang,cancelRacingSpinDoesNotHang,spinAfterCancelBeforeSpin(part of the cherry-pick) pass for all five executor types (15/15).test_executorssuite against the patched library: 151 pass, one timing flake inMultiThreadedExecutor.spinAll(the test's own "waitable executed at least twice within 1 s" count, not the cancel path) that passes 50/50 on repeat.PASS: spin() returned after cancel() issued before spin()against the patched library.test_executors152/152 (the 15 cancel tests included),test_context8/8,test_parameter_service10/10,test_events_cbg_executor_reentrant1/1.jazzy-updated+ the backport + the upstream sync.test_intra_process_managerdoes not compile onjazzy-updatedsince the improve lookup time for matches_any_publishers() ros2/rclcpp#3084 backport (d7c81509) because the test's mockPublisherBasehas noget_gid(). The library itself builds; the deep_cv image does not build rclcpp tests.ros_nav_dependencies.reposto this branch runs the full CI on it.🤖 Generated with Claude Code
https://claude.ai/code/session_01JQ4WGjY7nv1dR8zbyjipqY