-
Notifications
You must be signed in to change notification settings - Fork 47
Description
Describe the bug
On ROS 2 Jazzy, pressing Ctrl+C does not fully exit example nodes (e.g., sm_atomic_node) when built with Release/RelWithDebInfo. The first Ctrl+C triggers rclcpp’s signal handler and SMACC2 logs show state exit/cleanup and SignalDetector::pollingLoop() returning, but the process hangs until a second Ctrl+C or an external kill.
To Reproduce
Steps to reproduce the behavior:
- Build SMACC2 (branch: jazzy) with colcon.
- ros2 run sm_atomic sm_atomic_node
- Press Ctrl+C → node does not terminate.
Actual: main loop stops, but the scheduler thread (boost::thread running boost::statechart::fifo_scheduler<>::operator()) keeps running, so the process doesn’t exit. In Release this is very consistent.
It looks like jazzy’s SignalDetector lacks the graceful shutdown behavior that exists on Humble, specifically in:
smacc2/include/smacc2/smacc_signal_detector.hppsmacc2/src/smacc2/signal_detector.cpp
The Humble branch registers an on_shutdown callback on the node’s rclcpp Context, and ensures the scheduler is terminated so the thread returns. It also uses context-aware shutdown checks (and avoids spinning while holding the state machine mutex), which prevents deadlocks/hangs on optimized builds.
Request: please sync/backport the Humble fixes into the Jazzy branch (or advise if you’d like a PR). I’m concerned there may be other shutdown/robustness tweaks in Humble that didn’t make it to Jazzy.