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

support invalid handle exception from rclpy in the action LoadComposableNodes #391

Open
wants to merge 1 commit into
base: rolling
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions launch_ros/launch_ros/actions/load_composable_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
from launch.utilities import perform_substitutions
from launch_ros.parameter_descriptions import ParameterFile

from rclpy.exceptions import InvalidHandle

from .composable_node_container import ComposableNodeContainer

from ..descriptions import ComposableNode
Expand Down Expand Up @@ -116,14 +118,24 @@ def _load_node(
:param request: service request to load a node
:param context: current launch context
"""
while not self.__rclpy_load_node_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_load_node_client.srv_name
try:
while not self.__rclpy_load_node_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_load_node_client.srv_name
)
)
return
except InvalidHandle:
self.__logger.warning(
"Abandoning wait for the '{}' service, "
'due to invalid rclpy handle.'.format(
self.__rclpy_load_node_client.srv_name
)
return
)
return

# Asynchronously wait on service call so that we can periodically check for shutdown
event = threading.Event()
Expand Down