Coder Social home page Coder Social logo

Comments (2)

pbaughman avatar pbaughman commented on September 17, 2024

I spoke to @wjwwood and we suspect that things are getting hung here

The lifecycle node checks that a service is available and then tries to call it apparently without a timeout. If the service goes away after the check but before the call, we can maybe hang forever.

I'm trying to reproduce my issue again with additional instrumentation to confirm this hypothesis

from launch_ros.

pbaughman avatar pbaughman commented on September 17, 2024

@wjwwood It looks like you were right. I added some print statements to LifecycleNode:

    def _call_change_state(self, request, context: launch.LaunchContext):
        while not self.__rclpy_change_state_client.wait_for_service(timeout_sec=1.0):
            if context.is_shutdown:
                self.___logger.warning(
                    "Abandoning wait for the '{}' service, due to shutdown.".format(
                        self.__rclpy_change_state_client.srv_name),
                )
                return
        import time; time.sleep(0.5)
        print("Calling the service {}".format(request))
        response = self.__rclpy_change_state_client.call(request)
        print("Finished calling service got response {}".format(response))
        if not response.success:
            self.__logger.error(
                "Failed to make transition '{}' for LifecycleNode '{}'".format(
                    ChangeState.valid_transitions[request.transition.id],
                    self.node_name,
                )
            )

And finally got this to hang:

[lifecycle_listener-2] [INFO] [listener]: notify callback: Transition from state inactive to cleaningup
[lifecycle_listener-2] [INFO] [listener]: notify callback: Transition from state cleaningup to unconfigured
Finished calling service got response lifecycle_msgs.srv.ChangeState_Response(success=True)
Calling the service lifecycle_msgs.srv.ChangeState_Request(transition=lifecycle_msgs.msg.Transition(id=5, label=''))
[lifecycle_talker-1] [INFO] [lc_talker]: on shutdown is called from state unconfigured.
[lifecycle_listener-2] [INFO] [listener]: notify callback: Transition from state unconfigured to shuttingdown
[lifecycle_listener-2] [INFO] [listener]: notify callback: Transition from state shuttingdown to finalized
ok

----------------------------------------------------------------------
Ran 1 test in 4.858s

OK
[INFO] [lifecycle_listener-2]: sending signal 'SIGINT' to process[lifecycle_listener-2]
[INFO] [lifecycle_talker-1]: sending signal 'SIGINT' to process[lifecycle_talker-1]
[lifecycle_listener-2] [INFO] [rclcpp]: signal_handler(signal_value=2)
[lifecycle_talker-1] [INFO] [rclcpp]: signal_handler(signal_value=2)
[INFO] [lifecycle_listener-2]: process has finished cleanly [pid 13315]
[INFO] [lifecycle_talker-1]: process has finished cleanly [pid 13314]

As you can see, the final "Calling the service" does not have a matching "Finished calling service" line.

from launch_ros.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.