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_timer
andself._spin_until_future_complete_timeout
to wake the executor when the timeout is reached. Also addedtest_timer_in_task.py
to 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_args
or_last_kwargs
is different, the "timeout" path ofspin_until_future_complete
does exactly that, eachspin_once_until_future_complete
is 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.