Open
Conversation
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
Collaborator
fujitatomoya
left a comment
There was a problem hiding this comment.
adding timer based on timeout argument looks okay to avoid to keep creating generator, but i cannot really say what approach is reasonable.
@sloretz @ivanpauno could you share your thoughts?
ivanpauno
requested changes
Nov 8, 2022
Member
ivanpauno
left a comment
There was a problem hiding this comment.
I think there's something weird somewhere else, this doesn't look like the right fix.
Based on your comments in #985, I think we should be fixing what wait_for_ready_callbacks()/_wait_for_ready_callbacks() are doing.
I haven't exactly figured out what changes are needed, I will try to look again soon.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #985.
I am not familiar with the executor logic in rclpy, so this is a hacky fix I did. Instead of passing a new timeout each tick, I added
self._spin_until_future_complete_timerandself._spin_until_future_complete_timeoutto wake the executor when the timeout is reached. Also addedtest_timer_in_task.pyto test the new behavior.Looking at the code of
spin_until_future_complete, it behaves differently depending on if a timeout is provided.This all looks good but furthur investigation of
wait_for_ready_callbacks(which is eventually called later down the chain),It creates a new generator whenever
_last_argsor_last_kwargsis different, the "timeout" path ofspin_until_future_completedoes exactly that, eachspin_once_until_future_completeis passed a different timeout.My guess is that somehow creating new generators every "tick" causes new "work" to be created, and executing a "work" causes a new generator to be created, resulting in a infinite list of pending "work", which causes the actual task to never be executed.