create_timer throws but isn't documented to throw
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 805
- Forks
- 564
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 27
Description
Operating System:
Ubuntu 24
ROS version or commit hash:
Jazzy
RMW implementation (if applicable):
fastrtps
RMW Configuration (if applicable):
N/A
Client library (if applicable):
rclcpp
'ros2 doctor --report' output
N/A - it's proprietary
Steps to reproduce issue
- Create a node, and add a (while/for) loop call that blocks while rclcpp::ok() is true
- Trigger a ctrl+C on the node which now means that rclcpp::ok() is false
- Later in code execution, call create_timer(..
- Observe the timer creation fail and throw
- Observe a non-zero exit code from the node
Expected behavior
If exceptions are throw, they are documented in the header. Alternatively, create_timer could return nullptr and catch the exception.
Actual behavior
This exception is not documented
Additional information
[Thread 0x7fff5e7fc6c0 (LWP 1030613) exited]
terminate called after throwing an instance of 'rclcpp::exceptions::RCLError'
what(): Couldn't initialize rcl timer handle: the given context is not valid, either rcl_init() was not called or rcl_shutdown() was called., at ./src/rcl/guard_condition.c:67
Thread 1 "MyNode" received signal SIGABRT, Aborted.
Here's the backtrace.
If you need a minimum reproducible example, I can help provide one, but I haven't spent the time to write one yet.
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 with the rclcpp create_timer declarations in their header and reproduce the call after rclcpp shutdown using the reported sequence. Check each relevant overload's documented exceptions; done means the post-shutdown RCLError behavior is documented, unless maintainers decide the requested behavior change should be handled separately.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100