[Bug] subscription impossible while peer subscribes its own topic
Describe the bug
As per the title. The issue makes it impossible to RViz internal topics used by the robot.
To reproduce
Setup Cyclone DDS with ROS_LOCALHOST_ONLY=1.
Terminal 1:
ROS_DOMAIN_ID=1 zenoh_bridge_ros2dds-1.2.1 -l tcp/localhost:7000
Terminal 2:
ROS_DOMAIN_ID=2 zenoh_bridge_ros2dds-1.2.1 -e tcp/localhost:7000
Terminal 3:
ROS_DOMAIN_ID=1 ros2 topic pub /foobar std_msgs/msg/Bool "{data: true}"
Terminal 4:
ROS_DOMAIN_ID=2 ros2 topic echo /foobar
Messages will start flowing... Terminal 5:
ROS_DOMAIN_ID=1 ros2 topic echo /foobar
Messages will start flowing... Terminal 4:
CTRL+C
ROS_DOMAIN_ID=2 ros2 topic echo /foobar
The messages will not flow until Terminal 4 resubscribes while Terminal 5 is unsubscribed.
Details
Bug does not occur if Terminal 5 is the first subscriber since Zenoh Bridges were restarted. Then the first subscription after that from the opposite domain (Terminal 4) will succeed, but further re-subscriptions will be impossible.
Zenoh bridge node on the publisher side does not subscribe to the topic, which is visible on ros2 topic info -v.
Zenoh nodes do not show any errors in the logs.
When peer 1 subscribes to its own topic, Zenoh Bridge on peer 2 creates a subscriber for this topic which of course does not receive any messages since peer 1 is the publisher. Then when peer 2 wants to subscribe, it is possible that Zenoh Bridge does not create the subscriber on peer 1 since the bridge on peer 2 is already subscribed.
System info
- Platform: Ubuntu Jammy/Humble (distrobox on Arch Linux x86_64 host)
- CPU: AMD Ryzen 7 5800H (16) @ 3.0GHz
- Zenoh Version: Release 1.2.1
Might be related to #368
I can't believe that more people aren't reporting this problem. It is really easy to encounter which makes it important to be resolved ASAP. It is straightforward to reproduce, so can anybody confirm that they see it?
Hey, we can confirm that this is affecting us as well! We've had repeated problems for the past year where topics stop flowing until the Zenoh bridge is restarted on either end, but haven't been able to narrow it to a minimal reproducible example like this. We can reproduce your example commands and believe this is the same issue we're experiencing at a larger scale.
We can also confirm that using the always_create_subscriber workaround in the linked issue solves the problem (repeating the same steps described here works as intended, messages keep flowing into terminal 4).
Can't believe this still happens. Using 22.04 ubuntu, humble. Is this solved? maybe in 24.04?
Can't believe this still happens. Using 22.04 ubuntu, humble. Is this solved? maybe in 24.04?
So i've changed zenoh-bridge-ros2dds to peer mode, and the problem is solved :)