You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importlaunchimportlaunch_ros.actionsfromlaunchimportLaunchDescriptiondefgenerate_launch_description() ->LaunchDescription:
returnlaunch.LaunchDescription(
[
# Real nodes - these get left running when launch file throws exceptionlaunch_ros.actions.Node(
package="examples_rclcpp_minimal_publisher",
executable="publisher_member_function",
),
launch_ros.actions.Node(
package="examples_rclcpp_minimal_subscriber",
executable="subscriber_member_function",
),
# Fake node - this will cause an exception to be thrown.launch_ros.actions.Node(
package="examples_rclcpp_minimal_subscriber",
executable="fake_node",
),
]
)
Launch it
$ ros2 launch my_launch.py
Expected behavior
Launch catches exception and stops, including stopping any nodes that were started before the exception was caught, i.e., ros2 node list returns nothing afterwards.
Actual behavior
Launch catches exception and stops, but doesn't kill any of the already started nodes.
$ ros2 launch my_launch.py
[INFO] [launch]: All log files can be found below /home/jackie/.ros/log/2023-12-05-14-26-16-767994-stealth-126383
[INFO] [launch]: Default logging verbosity is set to INFO
[ERROR] [launch]: Caught exception in launch (see debug for traceback): executable 'fake_node' not found on the libexec directory '/opt/ros/iron/lib/examples_rclcpp_minimal_subscriber'
$ ros2 node list
/minimal_publisher
/minimal_subscriber
Additional information
Ideally of course the launch file is correctly written such that no exceptions are thrown in the first place. However, when in the process of writing a new launch file (especially one much larger than this example), it is hard to remember, unexpected and tedious to individually kill every node that was started before the exception was thrown.
In my own troubleshooting I looked at what happens when the launch file is Ctrl+C'd vs. what happens when an exception is caught. Perhaps there's something in there (namely, some behavior difference when LaunchService._shutdown() is passed due_to_sigint=True and force_sync=True)?
Bug report
Required Info:
Ubuntu 22.04
Binary
Iron 2.0.2
Default
N/A
Steps to reproduce issue
Create launch file
my_launch.py
Launch it
Expected behavior
Launch catches exception and stops, including stopping any nodes that were started before the exception was caught, i.e.,
ros2 node list
returns nothing afterwards.Actual behavior
Launch catches exception and stops, but doesn't kill any of the already started nodes.
Additional information
Ideally of course the launch file is correctly written such that no exceptions are thrown in the first place. However, when in the process of writing a new launch file (especially one much larger than this example), it is hard to remember, unexpected and tedious to individually kill every node that was started before the exception was thrown.
In my own troubleshooting I looked at what happens when the launch file is Ctrl+C'd vs. what happens when an exception is caught. Perhaps there's something in there (namely, some behavior difference when
LaunchService._shutdown()
is passeddue_to_sigint=True
andforce_sync=True
)?launch/launch/launch/launch_service.py
Lines 191 to 202 in f15691c
launch/launch/launch/launch_service.py
Lines 345 to 355 in f15691c
The text was updated successfully, but these errors were encountered: