# ros2 service call /my_service my_msgs/srv/MyService "{}" --timeout 5：服务调用在5秒后超时

- **ID:** `ros2/ros2cli-service-call-timeout`
- **领域:** ros2
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

服务服务器未运行，或由于高负载或QoS设置，网络延迟超过超时值。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| ros2-humble | active | — | — |
| ros2-iron | active | — | — |
| ros2-rolling | active | — | — |

## 解决方案

1. ```
   检查服务服务器节点是否运行：ros2 node list | grep my_service_server。如果未运行，启动服务器节点。
   ```
2. ```
   使用'ros2 service type /my_service'验证服务类型是否匹配；如果不匹配，在调用中更正服务类型。
   ```

## 无效尝试

- **** — If the server is not running, it will never respond; timeout just delays failure detection. (80% 失败率)
- **** — Service list may show stale entries; the server may have crashed after discovery. (50% 失败率)
