Skip to content

rclcpp::Node constructor and destructor crash with multithreading #1042

@rotu

Description

@rotu

Use of rclcpp::Node is unsafe in an asynchronous setting and can cause segfaults and undefined behavior if such objects are constructed and/or destructed simultaneously.

See ros2/rosbag2#329 where this directly caused a reproducible crash. While the particular crash was averted in ros2/rosbag2#338, the constructor/destructor still use the unsafe functions rcl_node_init/rcl_node_fini.

Either these functions should be made threadsafe or they should be documented as unsafe and audited/instrumented to detect such unsafe usage.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions