API footgun: shared_ptr to timer, ambiguous reset
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 805
- Forks
- 564
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 27
Description
Generated by Generative AI
No response
Operating System:
Linux JCAPC214 6.8.0-107-generic #107-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 13 19:51:50 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
ROS version or commit hash:
humble, rolling
RMW implementation (if applicable):
No response
RMW Configuration (if applicable):
No response
Client library (if applicable):
rclcpp
'ros2 doctor --report' output
No response
Steps to reproduce issue
rclcpp::TimerBase::SharedPtr timer =
node->create_wall_timer(1s, {
RCLCPP_INFO(rclcpp::get_logger("test"), "tick");
});
// Intended: restart the timer
timer->reset();
// Accidental change during refactor:
timer.reset(); // Timer is destroyed instead
Expected behavior
Likely requires a refactor to the api to make the reset_timer explicit and not collide with the pointer
Actual behavior
Your pointer is reset and needs to be reconstructed
Additional information
No response
Contributor 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.
Research direction
Start by reviewing the rclcpp::TimerBase::SharedPtr usage with create_wall_timer and the competing timer->reset() and timer.reset() calls shown in the reproduction. Determine whether an explicit timer-restart API is appropriate, then define the expected behavior and add coverage for restarting versus destroying the timer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100