AsyncParametersClient and get_parameter not working as expected
Maintainers usually reply within 1 day
@alsora is already working on this.
Since Feb 27, 2025.
Assessment
This issue has not been assessed yet.
Description
AsyncParametersClient and get_parameter Synchronization Issues
Description
There are synchronization issues between AsyncParametersClient::load_parameters() and Node::get_parameter() that make it difficult to reliably load and read parameters.
Problem
When loading parameters from a YAML file:
// Load parameters
parameters_client_->load_parameters(yaml_filepath_);
// Try to get updated values
get_parameter("number_particles", num_particles); // Still returns old value
Attempted solutions that don't work:
- Using futures:
auto future = parameters_client_->load_parameters(yaml_filepath_);
future.wait(); // Hangs indefinitely
- Using delays:
parameters_client_->load_parameters(yaml_filepath_);
std::this_thread::sleep_for(std::chrono::seconds(5)); // Even long delays don't help
get_parameter("number_particles", num_particles); // Still returns old value
- Double loading:
parameters_client_->load_parameters(yaml_filepath_);
parameters_client_->load_parameters(yaml_filepath_); // Try to force an update
The only way to get the updated values is to wait for another parameter event to trigger, suggesting the parameter cache isn't being properly updated.
Expected Behavior
load_parameters()should complete and ensure parameters are updatedget_parameter()should return the latest values immediately after loading
Actual Behavior
get_parameter()returns stale values until another parameter event occurs- Futures from
load_parameters()hang indefinitely - No reliable way to synchronize parameter loading and reading
- Dominant language
- C++
- Stars
- 829
- Forks
- 587
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 30
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ros2/rclcpp
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
-
Memory grows per callback group created and destroyed on long lived nodesPossibly taken @jwallace42 claimed this 1 day ago. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 28/100
ros2/rclcpp#3428 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
removing and immediately re-adding a node to the EventsCBGExecutor leaves its entities unregisteredPossibly taken @skyegalaxy claimed this 10 days ago. Openbug
ros2/rclcpp#3418 · 1 assignee ·
Maintainers usually reply within 1 day
-
[Humble] Removing a node with more than one auto-added callback group leaves a dangling guard condition in the executorPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 55/100
ros2/rclcpp#3410 · 2 comments ·
Maintainers usually reply within 1 day
Similar issues
-
bug
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
EchoTools/nevr-runtime#2912 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day
-
category:port-update
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
bug-unconfirmed
Difficulty 1/5 Under an hour Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
libc++
Difficulty 1/5 Under an hour Newbie friendliness 88/100
llvm/llvm-project#246508 ·
Maintainers usually reply within 1 day