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

Reject wrong lifecycle transitions without crash (#1209) #1317

Conversation

chrisbitter
Copy link

Fix for #1209

Instead of attempting to do a lifecycle transition and potentially crashing the node, it is first checked if a transition is valid. If it is not, it is ignored. The service caller gets notified via success = False.

Signed-off-by: Christian Bitter <cbi@circuli-ion.com>
@Barry-Xu-2018
Copy link
Contributor

Comment on lines +353 to +358

available_transition_ids = [t[0] for t in self._state_machine.available_transitions]
if transition_id not in available_transition_ids:
resp.success = False
return resp

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to the stack trace from #1209 (comment), the root cause of this exception is from __change_state. i think what we should do here is to catch the exception from the failure from rcl transition change, and print the error for user application.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. This PR only addresses the issue of external state changes through the "change_state" service.
Modifying __change_state is more appropriate.

@mjcarroll
Copy link
Member

@fujitatomoya has this been replaced by #1319? If so, can this one be closed?

@fujitatomoya
Copy link
Collaborator

@mjcarroll yes, i will go ahead to close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants