# [WARN] [rmw_fastrtps]: Discovery timed out after 30 seconds, some nodes may not be discovered

- **ID:** `ros2/ros2-graph-discovery-delay-large-system`
- **Domain:** ros2
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

Fast DDS discovery phase exceeded the default timeout due to a large number of nodes (e.g., >20) on the same network, causing incomplete ROS graph discovery.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| ros2:humble | active | — | — |
| ros2:iron | active | — | — |
| rmw_fastrtps_cpp:6.3.0 | active | — | — |
| fastdds:2.10.0 | active | — | — |

## Workarounds

1. **Use Fast DDS discovery server to reduce network traffic. Create a discovery server:
fastdds discovery --server-id 0

Then launch nodes with the server environment:
ROS_DISCOVERY_SERVER=127.0.0.1:11811 ros2 run my_package my_node

This centralizes discovery and reduces timeout issues.** (90% success)
   ```
   Use Fast DDS discovery server to reduce network traffic. Create a discovery server:
fastdds discovery --server-id 0

Then launch nodes with the server environment:
ROS_DISCOVERY_SERVER=127.0.0.1:11811 ros2 run my_package my_node

This centralizes discovery and reduces timeout issues.
   ```
2. **Increase the discovery timeout and reduce discovery traffic by setting environment variables:
export FASTRTPS_DEFAULT_PROFILES_FILE=/path/to/fastdds_profile.xml

In the XML, set:
<discovery_config>
  <leaseDuration>PT60S</leaseDuration>
  <announcementPeriod>PT5S</announcementPeriod>
</discovery_config>

Then restart nodes.** (80% success)
   ```
   Increase the discovery timeout and reduce discovery traffic by setting environment variables:
export FASTRTPS_DEFAULT_PROFILES_FILE=/path/to/fastdds_profile.xml

In the XML, set:
<discovery_config>
  <leaseDuration>PT60S</leaseDuration>
  <announcementPeriod>PT5S</announcementPeriod>
</discovery_config>

Then restart nodes.
   ```

## Dead Ends

- **Increasing the discovery timeout to 60 seconds via environment variable** — Merely extending the timeout does not address the underlying scalability issue; discovery may still fail with more nodes. (70% fail)
- **Restarting all nodes simultaneously** — Simultaneous startup can cause a discovery storm, making the problem worse. (85% fail)
