rosrun lifecycle_test_library managed_node_example.py
# configure
rostopic pub /example_node/lifecycle/goal lifecycle_msgs/LifecycleActionGoal "{goal: {transition: 20}}" -1
rostopic echo /example_node/chatter
# activate
rostopic pub /example_node/lifecycle/goal lifecycle_msgs/LifecycleActionGoal "{goal: {transition: 22}}" -1
# deactivate
rostopic pub /example_node/lifecycle/goal lifecycle_msgs/LifecycleActionGoal "{goal: {transition: 23}}" -1
# cleanup
rostopic pub /example_node/lifecycle/goal lifecycle_msgs/LifecycleActionGoal "{goal: {transition: 21}}" -1
Welcome to the example node
_on_configure
_on_activate
_on_deactivate
_on_cleanup
[WARN][1586962873.358237 /opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_base.py:349 /example_node]: Could not process inbound connection: [/example_node] is not a publisher of [/example_node/chatter]. Topics are [['/rosout', 'rosgraph_msgs/Log'], ['/example_node/lifecycle_state', 'lifecycle_msgs/Lifecycle'], ['/example_node/lifecycle/result', 'lifecycle_msgs/LifecycleActionResult'], ['/lm_events', 'lifecycle_msgs/lm_events'], ['/example_node/lifecycle/feedback', 'lifecycle_msgs/LifecycleActionFeedback'], ['/example_node/lifecycle/status', 'actionlib_msgs/GoalStatusArray']]{'message_definition': 'string data\n', 'callerid': '/rostopic_12774_1586962724795', 'tcp_nodelay': '0', 'md5sum': '992ce8a1687cec8c8bd883ec73ca41d1', 'topic': '/example_node/chatter', 'type': 'std_msgs/String'}
...
Getting rid of false shutdown warning and error messages is a big reason to use lifecycle management. (Are they really false warnings? Does anything leak?)
Not unregistering publishers is one option, but defeats the purpose of cleanup.
A system could be crafted so that subscribers are unregistered everywhere in the system before publishers, for example subscribers could be created in activation and unregistered in deactivation, and publishers in configure and cleanup, and non-lifecycle nodes would have to be shut down entirely. This only works where a system wide cleanup is what is desired as opposed to a single or small set of nodes- but the system wide case is more likely the one where avoiding false error messages is a higher priority.