rmw_fastrtps: Cannot communicate between nodes when only loopback is up

Bug report

Required Info:

  • Operating System:
    • Ubuntu 18.04, ARM64 (Rock64 board)
  • Installation type:
    • Source
  • Version or commit hash:
    • master
  • DDS implementation:
    • Fast-RTPS and Opensplice
  • Client library (if applicable):
    • rclcpp

Steps to reproduce issue

  1. Compile latest ros2 from master: colcon build --event-handlers console_cohesion+
  2. Source the workspace: source install/setup.bash
  3. Take down any active network interfaces, so that only loopback is running.
  4. Run ros2 run demo_nodes_cpp talker in one terminal.
  5. Run ros2 run demo_nodes_cpp listener in another terminal

Expected behavior

The talker and listener can communicate over localhost.

Actual behavior

The talker and listener cannot communicate.

Additional information

When testing this with Opensplice, I saw an error message to the effect that there were no Multicast interfaces available (I can get the full message later). This leads me to expect that DDS/RTPS isn’t doing any discovery because there is no multicast available. However, it still feels like communication in localhost should work in this scenario, hence the bug report.


Feature request

Feature description

Implementation considerations

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (17 by maintainers)

Most upvoted comments

I was receiving the same error, but found out that I had to enable multicast on lo because it’s not on by default (from: https://stackoverflow.com/a/30982079)

route add -net 224.0.0.0 netmask 240.0.0.0 dev lo
ifconfig lo multicast

Example output:

➜  ros2_ws ros2 multicast receive       
Waiting for UDP multicast datagram...
Traceback (most recent call last):
  File "/home/michael/workspaces/ros2_ws/install/ros2cli/bin/ros2", line 11, in <module>
    load_entry_point('ros2cli==0.5.4', 'console_scripts', 'ros2')()
  File "/home/michael/workspaces/ros2_ws/install/ros2cli/lib/python3.6/site-packages/ros2cli/cli.py", line 69, in main
    rc = extension.main(parser=parser, args=args)
  File "/home/michael/workspaces/ros2_ws/install/ros2multicast/lib/python3.6/site-packages/ros2multicast/command/multicast.py", line 39, in main
    return extension.main(args=args)
  File "/home/michael/workspaces/ros2_ws/install/ros2multicast/lib/python3.6/site-packages/ros2multicast/verb/receive.py", line 25, in main
    data, (host, port) = receive()
  File "/home/michael/workspaces/ros2_ws/install/ros2multicast/lib/python3.6/site-packages/ros2multicast/api/__init__.py", line 44, in receive
    s.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
OSError: [Errno 19] No such device
➜  ros2_ws sudo route add -net 224.0.0.0 netmask 240.0.0.0 dev lo
➜  ros2_ws sudo ifconfig lo multicast
➜  ros2_ws ros2 multicast receive                                
Waiting for UDP multicast datagram...
Received from 172.18.0.1:45392: 'Hello World!'

I went ahead and added https://github.com/ros2/ros2/wiki/Tutorials#troubleshooting to the tutorials page. I am happy to move the section to another better suited place. Let me know.

duplicate of ros2/ros2#552 ?