Program exits with code -11 when using async_send_request to set parameters in ROS 2 C++ client
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
まず、rclcpp::Client::async_send_request と spin_until_future_complete を、動作する promise/callback の例および rclcpp::SyncParametersClient の実装と比較します。この issue では、比較のために ros2cli call.py の実装もリンクされています。完了条件は、直接 future パスでセグメンテーションフォルトが発生する理由を特定し、async_send_request の一般的な使用方法に関するガイダンスを文書化することです。
索引モデルが issue の本文から書いたものです。
説明
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?
- 主要言語
- C++
- スター
- 829
- フォーク
- 587
- 平均マージ
- 4日 6時間
- マージ済み PR(30日)
- 30
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ros2/rclcpp のほかの issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
Memory grows per callback group created and destroyed on long lived nodes対応中かも @jwallace42 が 1 日前に担当しました。 オープンbug
難易度 4/5 3〜5日 初心者へのやさしさ 28/100
ros2/rclcpp#3428 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
removing and immediately re-adding a node to the EventsCBGExecutor leaves its entities unregistered対応中かも @skyegalaxy が 10 日前に担当しました。 オープンbug
メンテナーはふだん 1 日以内に返信
-
[Humble] Removing a node with more than one auto-added callback group leaves a dangling guard condition in the executor対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
arch-based bug niri
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
noctalia-dev/noctalia#5552 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
EchoTools/nevr-runtime#2912 ·
メンテナーはふだん 1 日以内に返信
-
area/docdb kind/failing-test priority/medium status/awaiting-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
yugabyte/yugabyte-db#39462 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
meshtastic/firmware#12519 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 1 日以内に返信