[Humble] Removing a node with more than one auto-added callback group leaves a dangling guard condition in the executor
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 55/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- cpp
- Bereich
- backend-api-design
Rechercherichtung
Start with Executor::remove_node and remove_callback_group_from_map, then inspect how callback group guard conditions are removed from the memory strategy and how wait_for_work cleans up expired groups. The report identifies the suspected branch and the Humble fix direction. Done when unloading a node with multiple automatically added callback groups no longer leaves a dangling guard condition and both executor variants keep running.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Bug report
- Operating system: Ubuntu 22.04
- Installation type: binaries
- Version: Humble, rclcpp 16.0.8 (code unchanged in 16.0.21)
- DDS implementation: Fast DDS (
rmw_fastrtps_cpp) - Client library: rclcpp
Steps to reproduce
A composable node that keeps one extra callback group alive as a member (added to the executor automatically) with a timer on it:
#include <chrono>
#include <rclcpp/rclcpp.hpp>
#include <rclcpp_components/register_node_macro.hpp>
namespace repro
{
// Parameter extra_group:=false puts the timer on the default group (the control case).
class TwoGroup : public rclcpp::Node
{
public:
explicit TwoGroup(const rclcpp::NodeOptions & options)
: Node("two_group", options)
{
if (declare_parameter("extra_group", true)) {
group_ = create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive);
}
timer_ = create_wall_timer(std::chrono::seconds(1), [] {}, group_);
}
private:
rclcpp::CallbackGroup::SharedPtr group_;
rclcpp::TimerBase::SharedPtr timer_;
};
} // namespace repro
RCLCPP_COMPONENTS_REGISTER_NODE(repro::TwoGroup)
CMake: add_library(two_group SHARED ...) plus rclcpp_components_register_nodes(two_group "repro::TwoGroup").
/opt/ros/humble/lib/rclcpp_components/component_container_mt --ros-args -r __node:=repro_container &
ros2 component load /repro_container two_group_repro repro::TwoGroup -p extra_group:=true
ros2 component unload /repro_container 1
Expected behaviour
The node unloads and the container keeps running.
Actual behaviour
component_container_mt: segmentation fault right after the unload (3/3 runs). Withextra_group:=false(timer on the default group) the container survives (3/3).component_container(single-threaded): aborts (SIGABRT) withextra_group:=true; survives withfalse.- In a larger node, gdb shows the fault in
__rmw_wait(rmw_fastrtps_shared_cpp) on the guard condition of one of the removed node's callback groups, already destroyed by~NodeBase.
Additional information
Executor::remove_node calls remove_callback_group_from_map for each of the node's groups. That function removes the group's guard condition from the memory strategy, and erases it from weak_groups_to_guard_conditions_, only inside the !has_node(...) && !has_node(...) branch, which is true only for the node's last group. Every earlier group's guard condition stays in the memory strategy as a raw pointer and dangles once the node is destroyed. The expired-group cleanup in wait_for_work does not catch it, because remove_callback_group_from_map has already erased the group from weak_groups_to_nodes_. Jazzy's executor rewrite removed this code; a Humble fix would move the guard-condition removal out of that branch.
- Vorherrschende Sprache
- C++
- Sterne
- 829
- Forks
- 587
- Ø Merge
- 4 T. 6 Std.
- Gemergte PRs (30 T.)
- 30
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus ros2/rclcpp
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
Maintainer antworten meist innerhalb von 1 Tag
-
Memory grows per callback group created and destroyed on long lived nodesEvtl. vergeben @jwallace42 hat das vor 1 Tag übernommen. Offenbug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 28/100
ros2/rclcpp#3428 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
removing and immediately re-adding a node to the EventsCBGExecutor leaves its entities unregisteredEvtl. vergeben @skyegalaxy hat das vor 10 Tagen übernommen. Offenbug
ros2/rclcpp#3418 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Copy constructor exception leaks intra-process message allocationEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
arch-based bug niri
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
noctalia-dev/noctalia#5552 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 82/100
EchoTools/nevr-runtime#2912 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area/docdb kind/failing-test priority/medium status/awaiting-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
yugabyte/yugabyte-db#39462 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
meshtastic/firmware#12519 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 79/100
Maintainer antworten meist innerhalb von 1 Tag