Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconsider lifecycle state transition when returning FAILURE for on_shutdown transition. #1763

Open
bpwilcox opened this issue Sep 2, 2021 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@bpwilcox
Copy link
Contributor

bpwilcox commented Sep 2, 2021

I can't say it's accurate to call this a bug, however the ROS2 lifecycle design documentation does not clearly specify the appropriate behavior for what happens when a FAILURE code is returned from a transition callback. The doc only mentions specifically that a failed configuring transition should result in the original (here unconfigured) state. It turns out that, though unspecified in the design diagram or otherwise in the doc, this is the behavior for all the transitions EXCEPT the shutdown transition. I believe this is fair behavior, however, when a user returns CallbackReturn::FAILURE in the on_shutdown transition callback, the resulting state is the same as if it had succeeded, the finalized state. This seems dangerous and prone to issues particular in interpreting the finalized state. To the design doc's own description, the shutdown transition should be responsible for any "cleanup necessary before destruction". Thus, if the user intentionally returns a failure code, it is counterintuitive to transition into the finalized state as though it had succeeded.

Yes, a user can return a CallbackReturn::ERROR, but these are different use cases. I believe that the failure return code should behave the same way here as it does for the other transitions. Since a shutdown can be triggered from any primary state, if that transition fails, it should return to the previous state.

@clalancette clalancette added the help wanted Extra attention is needed label Feb 3, 2022
@bpwilcox
Copy link
Contributor Author

bpwilcox commented Feb 9, 2022

Looking at ros2/design#283 (comment) and ros2/design#283 (comment), I agree that the failure transitions should be properly documented and that the shutdown failure behavior should return to the previous state.

@CursedRock17
Copy link
Contributor

As per this comment:

It was recommended that if the node had shutdown, then it would raise a failure and be left as this node is now "dead" which means that its state doesn't matter. This could be left alone unless the core designers would rather change the way nodes change on shutdown, but that seems unnecessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants