-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix an inherent race in execution vs. destruction. (#1150)
* Fix an inherent race in execution vs. destruction. The rclpy executor collects all of the entities in one pass, then creates async tasks for each of the ready ones and attempts to "take" and execute them. If one of those entities is destroyed after the collection but before we attempt to "take" it, then we can end up attempting to __enter__ a Destroyable-derived class that has already been destroyed. The Destroyable will then raise an InvalidHandle error. Fix this by explicitly catching the InvalidHandle error that can be raised in all of the Destroyable-derived entities. If we do catch it, then we actually let the machinery continue but tell things to just not execute; in a subsequent executor iteration, the entity will be destroyed and hence not looked at anymore. This seems to fix the race in my testing. Signed-off-by: Chris Lalancette <[email protected]>
- Loading branch information
1 parent
93fd107
commit 159ced4
Showing
1 changed file
with
102 additions
and
63 deletions.
There are no files selected for viewing
This file contains 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