-
Notifications
You must be signed in to change notification settings - Fork 435
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
Shutdown transition on base lifecycle node dtor may lead to segaults on subclass-registered shutdown callback #2553
Comments
@gabrielfpacheco thanks for creating issue. at a glance, i think we should remove all callbacks registered in the destructor since |
@fujitatomoya Could you please elaborate on what drove the decision for the call to |
Subscribers to the node lifecycle state are notified of the shutdown event. Helpful for applications managing node state or for reporting to the user. That's about it, since as you point out, the subclass on_shutdown cannot be called from the base dtor. |
Thanks for the info. Unfortunately, I think it creates more problems than it solves though. |
Yes, it's error prone and hard to make assumptions when the |
see #2520 (comment), all related to PRs are rolled back and merged. i will go ahead to close this issue, feel free to reopen if i miss anything. |
Bug report
Required Info:
Steps to reproduce issue
Execute the following test suite:
Expected behavior
No segfaults on node destruction :)
Actual behavior
Additional information
The issue started to happen after May 23rd Humble release. In this release, it has been introduced some logic to trigger the
shutdown
transition fromrclcpp::Lifecycle
destructor. This modification was later on reverted, but the revert was not backported to Humble's 16.0.9 and Iron's 21.06 although present in Jazzy's 28.1.2 release.Triggering the
shutdown
transition from the base class destructor will eventually call the a user-registeredon_shutdown
callback at the derived class. As the subclass destructor is called before the base class', this leads to undesired behavior of calling functions of an already-destructed object, which may lead to segmentation faults.Feature request
If the decision to trigger a
shutdown
transition from the node destructor is kept, shouldn't there be an API atrclcpp::Lifecycle
to unregister a shutdown callback the user has initially registered?The text was updated successfully, but these errors were encountered: