Skip to content

Executor does not maintain a reference to nodes #726

@rotu

Description

@rotu

Bug report

Required Info:

  • Operating System:
    • Ubuntu 18.04.2 LTS (Bionic Beaver)
  • Installation type:
    • from source
  • Version or commit hash:
  • DDS implementation:
    • Fast-RTPS
  • Client library (if applicable):
    • rclcpp

Steps to reproduce issue

Create a shared pointer to a Node, pass it to SingleThreadedExecutor::add_node. Delete or reset the shared pointer. Spin the executor.

#include "rclcpp/rclcpp.hpp"

int main(int argc, char** argv)
{
  rclcpp::init(argc, argv);

  rclcpp::executors::SingleThreadedExecutor executor;
  executor.add_node(std::make_shared<rclcpp::Node>("Test"));
  executor.spin();
  return 0;
}

Expected behavior

The node should run.

Actual behavior

ROS crashes with an error like:

[ERROR] [rclcpp]: Couldn't add guard_condition to wait set: guard condition implementation is invalid, at /opt/ros/master/src/ros2/rcl/rcl/src/rcl/guard_condition.c:174, at /opt/ros/master/src/ros2/rcl/rcl/src/rcl/wait.c:455
terminate called after throwing an instance of 'std::runtime_error'
  what():  Couldn't fill wait set

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions