Skip to content

Waitset not triggering timer when initialized in lifecycle node #2652

@luca-della-vedova

Description

@luca-della-vedova

Bug report

Required Info:

  • Operating System:
    • Ubuntu 24.04
  • Installation type:
    • Jazzy binaries (but reproducible from source, bisected to the commit linked below which introduced the issue)
  • Version or commit hash:
    • I bisected and found the exact commit that introduced this behavior (it was OK before): 5632a09
  • DDS implementation:
    • Cyclone
  • Client library (if applicable):
    • rclcpp

Steps to reproduce issue

ros2 lifecycle set /minimal_timer configure
ros2 lifecycle set /minimal_timer activate
ros2 run examples_rclcpp_minimal_service service_main

Expected behavior

Since the service callback destroys only timer_, timer2_ should keep running and Hello, world! should keep printing.

Actual behavior

All timers are stopped and no Hello, world! is printed.

Additional information

The following might shed some light into this.

  • If the timer that is erronously not triggered is initialized in the constructor, rather than in a lifecycle transition, the issue does not arise.
  • If the action server is ran before the lifecycle transition (which means timer2_ is only created after timer_ is destroyed) the issue does not arise.
  • If I manually add a || true here making this condition always evaluate to true, all timers are executed, however I added some printing when timers are cleaned up / added and I can see that every iteration a timer gets added and removed, so something odd is going on there.

So I suspect there is something about how timers (and maybe other entities?) are added to wait sets inside lifecycle node transitions that creates this issue.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions