You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Single-threaded executor can be starved by timers #392
Context (comes from ros2/demos#187): A single-threaded executor has a timer scheduled for every N seconds, and also a service server.
Bug: If the timer callback takes >=N seconds to complete, the executor will never process service requests once the timer is triggered for the first time.
This is because of the combination of the following:
Forcing get_next_executable to always call wait_for_workand giving timers lower priority in get_next_ready_executable will fix this situation, but it is inefficient to wait when it's not necessary, and I'm not sure checking timers last is a fix-all (could there be a parallel situation when the server needs to be the lowest priority?).
@dirk-thomas mentioned that a queue of some sort is probably more appropriate, so that get_next_executable processes events in the order that they were received.
For now, we have to recommend that users not permit timer callbacks to block for longer than the duration at which they're scheduled (this might be in our documentation somewhere already?).
related to executor starvation reported #280
Right now we will match the behavior of rclpy and provide documentation as of how to make custom executors.
@dhood I assigned you to this ticket, but added it to the untargeted milestone given the last comment of @mikaelarguedas that documentation might suffice for the moment.
Please feel free to iterate over it again or assign it to bouncy in case you this behavior has to be fixed before the release.
We shouldn't mark this with the milestone untargeted since that implies that we won't "ever" look at it again. Since this is actually a bug we would like to fix at some point I will remove the milestone.
👋 I ended up here trying to find our why when I had multiple timers with short intervals (and longer callbacks) only the first one worked, the others are never executed.
@ubald I do not believe what you've described is the issue here. This issue is essential that we do not have fair scheduling and so as long as timers are always ready then other things like Services will never get handled. However, more than "the first one" work in this case.
Please bear with me here, I just started with ROS2 yesterday, I don't have a full grasp of all the pieces involved yet, but when looking at the code it looks to me like it's related:
Activity
mikaelarguedas commentedon Nov 9, 2017
related to executor starvation reported #280
Right now we will match the behavior of rclpy and provide documentation as of how to make custom executors.
Karsten1987 commentedon Feb 26, 2018
@dhood I assigned you to this ticket, but added it to the untargeted milestone given the last comment of @mikaelarguedas that documentation might suffice for the moment.
Please feel free to iterate over it again or assign it to bouncy in case you this behavior has to be fixed before the release.
dirk-thomas commentedon Feb 26, 2018
We shouldn't mark this with the milestone
untargetedsince that implies that we won't "ever" look at it again. Since this is actually a bug we would like to fix at some point I will remove the milestone.ubald commentedon Mar 12, 2019
👋 I ended up here trying to find our why when I had multiple timers with short intervals (and longer callbacks) only the first one worked, the others are never executed.
Is it possible that both issues are related?
wjwwood commentedon Mar 12, 2019
@ubald I do not believe what you've described is the issue here. This issue is essential that we do not have fair scheduling and so as long as timers are always ready then other things like Services will never get handled. However, more than "the first one" work in this case.
ubald commentedon Mar 12, 2019
Thanks for the quick reply!
Please bear with me here, I just started with ROS2 yesterday, I don't have a full grasp of all the pieces involved yet, but when looking at the code it looks to me like it's related:
When calling
get_next_timer:rclcpp/rclcpp/src/rclcpp/executor.cpp
Line 518 in 070b312
It iterates over all timers in the same order each time, so it will always start by checking the first one created
rclcpp/rclcpp/src/rclcpp/executor.cpp
Lines 500 to 502 in 070b312
Then if it has been running for longer than its interval it will always be ready here in rcl
I'll see if I can switch from a debian install to a source build, this way I might try to fix it and make a PR.
Split test_token to avoid compiler note (ros2#392)
add missing test dependency (ros2#392)