-
Notifications
You must be signed in to change notification settings - Fork 126
Description
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.