Program exits with code -11 when using async_send_request to set parameters in ROS 2 C++ client
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu bằng cách so sánh rclcpp::Client::async_send_request và spin_until_future_complete với ví dụ promise/callback đang hoạt động và phần triển khai rclcpp::SyncParametersClient. Issue cũng liên kết đến phần triển khai ros2cli call.py để so sánh. Hoàn thành có nghĩa là xác định lý do đường dẫn future trực tiếp gây ra segmentation fault và ghi lại hướng dẫn chung về cách sử dụng async_send_request.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug report
Required Info:
- Operating System:
- Ubuntu 22.04
- Installation type:
- binary (apt)
- Version or commit hash:
- humble
- DDS implementation:
- default
- Client library (if applicable):
- rclcpp
Steps to reproduce issue
I am encountering a segmentation fault (exit code -11) when using the async_send_request method to set parameters in a ROS 2 C++ client. Below is the relevant code snippet:
const auto set_parameters_req = std::make_shared<rcl_interfaces::srv::SetParameters::Request>();
auto set_parameters_resp = set_parameters_client_->async_send_request(set_parameters_req);
EXPECT_EQ(rclcpp::FutureReturnCode::SUCCESS, rclcpp::spin_until_future_complete(node_, set_parameters_resp));
Actual behavior
When executing the above code, the program exits with code -11 at the spin_until_future_complete call.
Additional information
The direct use of ros2 service call from the command line works correctly, and its implementation in Python at ros2cli GitHub resembles the C++ code I am using.
An alternative approach, using a promise and callback with async_send_request, does work as shown below. This approach is inspired by the implementation in rclcpp::SyncParametersClient:
auto promise_result = std::make_shared<std::promise<std::vector<rcl_interfaces::msg::SetParametersResult>>>();
set_parameters_client_->async_send_request(
set_parameters_req,
[promise_result, future_result](rclcpp::Client<rcl_interfaces::srv::SetParameters>::SharedFuture cb_f) {
promise_result->set_value(cb_f.get()->results);
}
);
rclcpp::spin_until_future_complete(test_node_, future_result);
Questions:
- Why does the first approach result in a segmentation fault while the second approach and the Python version work correctly?
- Are there any general rules or guidelines for using async_send_request in ROS 2 C++ clients to avoid such issues?
- Ngôn ngữ chính
- C++
- Star
- 829
- Fork
- 587
- Merge trung bình
- 4 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 30
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ros2/rclcpp
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Memory grows per callback group created and destroyed on long lived nodesCó thể đã có người làm @jwallace42 đã nhận 1 ngày trước. Đang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 28/100
ros2/rclcpp#3428 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
removing and immediately re-adding a node to the EventsCBGExecutor leaves its entities unregisteredCó thể đã có người làm @skyegalaxy đã nhận 10 ngày trước. Đang mởbug
ros2/rclcpp#3418 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Humble] Removing a node with more than one auto-added callback group leaves a dangling guard condition in the executorCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
ros2/rclcpp#3410 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
arch-based bug niri
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
noctalia-dev/noctalia#5552 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
EchoTools/nevr-runtime#2912 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area/docdb kind/failing-test priority/medium status/awaiting-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
yugabyte/yugabyte-db#39462 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
meshtastic/firmware#12519 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày