rmw_fastrtps: Using different typesupports on same node and topic ends in segfault
Bug report
Required Info:
- Operating System:
- Ubuntu 18.04
- Installation type:
- Source
- Version or commit hash:
- Head
- DDS implementation:
- Fast RTPS
- Client library (if applicable):
- N/A
Steps to reproduce issue
Create a node that registers to an already registered topic but with a different typesupport. If we assume that the node is using rosout log, and that rosout regsiters a publisher in the /rosout topic with C typesupport. You can subscribe to the /rosout topic with a CPP typesupport.
#include <iostream>
#include "rclcpp/rclcpp.hpp"
#include <rcl_interfaces/msg/log.hpp>
class MinimalSubscriber : public rclcpp::Node
{
public:
MinimalSubscriber()
: Node("minimal_subscriber")
{
subscription_ = this->create_subscription<rcl_interfaces::msg::Log>(
"rosout",
[this](rcl_interfaces::msg::Log::UniquePtr msg) {
RCLCPP_INFO(this->get_logger(), "I heard: '%s'", msg->msg.c_str());
});
}
private:
rclcpp::Subscription<rcl_interfaces::msg::Log>::SharedPtr subscription_;
};
int main(int argc, char * argv[])
{
rclcpp::init(argc, argv);
rclcpp::spin(std::make_shared<MinimalSubscriber>());
rclcpp::shutdown();
return 0;
}
Expected behavior
Both registered publisher and subscribers should be able to publish and receive messages for the topic.
Actual behavior
The process exits with a segfault when receiving a message on the subscribed topic.
Additional information
Two different typesupports cannot be in the same topic at the same time. This is due to the fact that rmw_fastrtps uses the same name to register both typesupports in the FastRTPS Domain. See code
Disambiguate with a different name (appending or prepending a string) is not possible because the name of the typesupport is directly related to the name of the topic. See code and fastrtps TopicData
Probably happening in other implementations.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 29 (25 by maintainers)
Commits related to this issue
- Drop workaround for https://github.com/ros2/rmw_fastrtps/issues/265. Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com> — committed to ros2/ros1_bridge by hidmic 4 years ago
- Drop workaround for https://github.com/ros2/rmw_fastrtps/issues/265. (#233) Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com> — committed to ros2/ros1_bridge by hidmic 4 years ago
@dirk-thomas I just created PR #342 which should solve this. Merry Xmas! 🎅
@dirk-thomas this issue was not prioritized sorry. I can assign resources to this as soon we finish the release of Fast RTPS for eloquent, scheduled for next week.
This seems like a conversation that needs to be turned into an issue on roslaunch to support passing these kinds of parameters properly.
Commenting that this appears to prevent a lifecycle node from subscribing to the
.../transition_eventtopic of another lifecycle node. A C++ subscriber crashes when taking data because the C typesupport was established for type byrcl_lifecycle.backtrace