Skip to content

[launch_yaml] Inconsistent handling of respawn_max_retries leads to runtime TypeError and broken shutdown #968

@ok-tmhr

Description

@ok-tmhr

Generated by Generative AI

ChatGPT

Operating System:

Linux 22f9ae8fc1e5 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

ROS version or commit hash:

jazzy

RMW implementation (if applicable):

rmw_fastrtps_cpp

RMW Configuration (if applicable):

No response

Client library (if applicable):

No response

'ros2 doctor --report' output

ros2 doctor --report
   NETWORK CONFIGURATION
inet         : 127.0.0.1
inet4        : ['127.0.0.1']
inet6        : ['::1']
netmask      : 255.0.0.0
device       : lo
flags        : 73<RUNNING,LOOPBACK,UP>
mtu          : 65536
inet         : 172.25.0.2
inet4        : ['172.25.0.2']
ether        : e6:72:5d:14:20:44
netmask      : 255.255.0.0
device       : eth0
flags        : 4163<BROADCAST,RUNNING,UP,MULTICAST>
mtu          : 1500
broadcast    : 172.25.255.255

   PACKAGE VERSIONS
nav_msgs                                  : latest=5.3.7, local=5.3.7
ament_cmake_test                          : latest=2.5.6, local=2.5.6
rosidl_dynamic_typesupport_fastrtps       : latest=0.1.0, local=0.1.0
ament_cmake_python                        : latest=2.5.6, local=2.5.6
ament_cmake_export_link_flags             : latest=2.5.6, local=2.5.6
rclcpp                                    : latest=28.1.18, local=28.1.18
ros2multicast                             : latest=0.32.9, local=0.32.9
ros2cli_common_extensions                 : latest=0.3.1, local=0.3.1
rcpputils                                 : latest=2.11.3, local=2.11.3
actionlib_msgs                            : latest=5.3.7, local=5.3.7
launch                                    : latest=3.4.10, local=3.4.10
ros2lifecycle                             : latest=0.32.9, local=0.32.9
ament_cmake_gtest                         : latest=2.5.6, local=2.5.6
diagnostic_msgs                           : latest=5.3.7, local=5.3.7
action_msgs                               : latest=2.0.3, local=2.0.3
ros2cli                                   : latest=0.32.9, local=0.32.9
ros_workspace                             : latest=1.0.3, local=1.0.3
ament_cmake_export_include_directories    : latest=2.5.6, local=2.5.6
ament_cppcheck                            : latest=0.17.5, local=0.17.5
sensor_msgs                               : latest=5.3.7, local=5.3.7
launch_yaml                               : latest=3.4.10, local=3.4.10
rosidl_typesupport_fastrtps_cpp           : latest=3.6.3, local=3.6.3
rosidl_cmake                              : latest=4.6.7, local=4.6.7
ament_cmake_export_interfaces             : latest=2.5.6, local=2.5.6
rosidl_runtime_py                         : latest=0.13.1, local=0.13.1
ament_cpplint                             : latest=0.17.5, local=0.17.5
ros_core                                  : latest=0.11.0, local=0.11.0
libyaml_vendor                            : latest=1.6.3, local=1.6.3
ament_cmake_version                       : latest=2.5.6, local=2.5.6
class_loader                              : latest=2.7.0, local=2.7.0
ament_flake8                              : latest=0.17.5, local=0.17.5
geometry_msgs                             : latest=5.3.7, local=5.3.7
rcutils                                   : latest=6.7.5, local=6.7.5
shape_msgs                                : latest=5.3.7, local=5.3.7
rmw_implementation                        : latest=2.15.6, local=2.15.6
rosidl_typesupport_cpp                    : latest=3.2.2, local=3.2.2
ament_cmake_auto                          : latest=2.5.6, local=2.5.6
ament_lint_common                         : latest=0.17.5, local=0.17.5
ament_cmake                               : latest=2.5.6, local=2.5.6
ament_cmake_cppcheck                      : latest=0.17.5, local=0.17.5
trajectory_msgs                           : latest=5.3.7, local=5.3.7
libstatistics_collector                   : latest=1.7.4, local=1.7.4
ament_cmake_gen_version_h                 : latest=2.5.6, local=2.5.6
launch_testing                            : latest=3.4.10, local=3.4.10
ros2interface                             : latest=0.32.9, local=0.32.9
ament_index_python                        : latest=1.8.3, local=1.8.2
ament_cmake_copyright                     : latest=0.17.5, local=0.17.5
ament_cmake_ros                           : latest=0.12.0, local=0.12.0
rosidl_generator_cpp                      : latest=4.6.7, local=4.6.7
launch_testing_ament_cmake                : latest=3.4.10, local=3.4.10
composition_interfaces                    : latest=2.0.3, local=2.0.3
ros2service                               : latest=0.32.9, local=0.32.9
sros2                                     : latest=0.13.6, local=0.13.6
python_cmake_module                       : latest=0.11.1, local=0.11.1
ros2component                             : latest=0.32.9, local=0.32.9
rosidl_cli                                : latest=4.6.7, local=4.6.7
ament_cmake_export_definitions            : latest=2.5.6, local=2.5.6
uncrustify_vendor                         : latest=3.0.1, local=3.0.1
ament_cmake_libraries                     : latest=2.5.6, local=2.5.6
ament_lint                                : latest=0.17.5, local=0.17.5
rosidl_typesupport_fastrtps_c             : latest=3.6.3, local=3.6.3
ament_cmake_export_libraries              : latest=2.5.6, local=2.5.6
ament_index_cpp                           : latest=1.8.3, local=1.8.2
service_msgs                              : latest=2.0.3, local=2.0.3
rosidl_typesupport_introspection_cpp      : latest=4.6.7, local=4.6.7
statistics_msgs                           : latest=2.0.3, local=2.0.3
ament_package                             : latest=0.16.5, local=0.16.5
rosidl_runtime_c                          : latest=4.6.7, local=4.6.7
rmw_dds_common                            : latest=3.1.1, local=3.1.1
tinyxml2_vendor                           : latest=0.9.2, local=0.9.2
rcl_logging_spdlog                        : latest=3.1.1, local=3.1.1
ros2doctor                                : latest=0.32.9, local=0.32.9
ament_uncrustify                          : latest=0.17.5, local=0.17.5
launch_ros                                : latest=0.26.11, local=0.26.11
visualization_msgs                        : latest=5.3.7, local=5.3.7
rclcpp_components                         : latest=28.1.18, local=28.1.18
ament_xmllint                             : latest=0.17.5, local=0.17.5
rosidl_parser                             : latest=4.6.7, local=4.6.7
rosidl_typesupport_c                      : latest=3.2.2, local=3.2.2
ament_cmake_gmock                         : latest=2.5.6, local=2.5.6
unique_identifier_msgs                    : latest=2.5.0, local=2.5.0
ros2action                                : latest=0.32.9, local=0.32.9
ament_cmake_include_directories           : latest=2.5.6, local=2.5.6
tracetools                                : latest=8.2.5, local=8.2.5
ament_cmake_lint_cmake                    : latest=0.17.5, local=0.17.5
sros2_cmake                               : latest=0.13.6, local=0.13.6
stereo_msgs                               : latest=5.3.7, local=5.3.7
spdlog_vendor                             : latest=1.6.1, local=1.6.1
rclcpp_lifecycle                          : latest=28.1.18, local=28.1.18
rcl_lifecycle                             : latest=9.2.9, local=9.2.9
rosgraph_msgs                             : latest=2.0.3, local=2.0.3
domain_coordinator                        : latest=0.12.0, local=0.12.0
rosidl_typesupport_introspection_c        : latest=4.6.7, local=4.6.7
rosidl_generator_c                        : latest=4.6.7, local=4.6.7
launch_xml                                : latest=3.4.10, local=3.4.10
ros2launch                                : latest=0.26.11, local=0.26.11
launch_testing_ros                        : latest=0.26.11, local=0.26.11
rosidl_generator_type_description         : latest=4.6.7, local=4.6.7
ament_cmake_flake8                        : latest=0.17.5, local=0.17.5
ros_environment                           : latest=4.2.1, local=4.2.1
rosidl_core_runtime                       : latest=0.2.1, local=0.2.1
rosidl_default_runtime                    : latest=1.6.0, local=1.6.0
rosidl_runtime_cpp                        : latest=4.6.7, local=4.6.7
rcl_interfaces                            : latest=2.0.3, local=2.0.3
ros2node                                  : latest=0.32.9, local=0.32.9
ament_cmake_target_dependencies           : latest=2.5.6, local=2.5.6
rosidl_default_generators                 : latest=1.6.0, local=1.6.0
ament_cmake_cpplint                       : latest=0.17.5, local=0.17.5
ament_lint_auto                           : latest=0.17.5, local=0.17.5
ament_copyright                           : latest=0.17.5, local=0.17.5
ros2pkg                                   : latest=0.32.9, local=0.32.9
std_msgs                                  : latest=5.3.7, local=5.3.7
rosidl_generator_rs                       : latest=0.4.12, local=0.4.11
ros2topic                                 : latest=0.32.9, local=0.32.9
osrf_pycommon                             : latest=2.1.7, local=2.1.7
rosidl_dynamic_typesupport                : latest=0.1.2, local=0.1.2
rcl_yaml_param_parser                     : latest=9.2.9, local=9.2.9
rpyutils                                  : latest=0.4.2, local=0.4.2
rmw_fastrtps_shared_cpp                   : latest=8.4.3, local=8.4.3
ament_cmake_xmllint                       : latest=0.17.5, local=0.17.5
rmw                                       : latest=7.3.3, local=7.3.3
ament_lint_cmake                          : latest=0.17.5, local=0.17.5
rclpy                                     : latest=7.1.11, local=7.1.11
rmw_fastrtps_cpp                          : latest=8.4.3, local=8.4.3
lifecycle_msgs                            : latest=2.0.3, local=2.0.3
rcl                                       : latest=9.2.9, local=9.2.9
ament_cmake_pytest                        : latest=2.5.6, local=2.5.6
rosidl_adapter                            : latest=4.6.7, local=4.6.7
std_srvs                                  : latest=5.3.7, local=5.3.7
ament_cmake_core                          : latest=2.5.6, local=2.5.6
ament_pep257                              : latest=0.17.5, local=0.17.5
ament_cmake_export_targets                : latest=2.5.6, local=2.5.6
fastrtps_cmake_module                     : latest=3.6.3, local=3.6.3
console_bridge_vendor                     : latest=1.7.1, local=1.7.1
ament_cmake_export_dependencies           : latest=2.5.6, local=2.5.6
rclcpp_action                             : latest=28.1.18, local=28.1.18
ros2plugin                                : latest=5.4.5, local=5.4.5
ament_cmake_uncrustify                    : latest=0.17.5, local=0.17.5
rcl_action                                : latest=9.2.9, local=9.2.9
ament_cmake_pep257                        : latest=0.17.5, local=0.17.5
builtin_interfaces                        : latest=2.0.3, local=2.0.3
rosidl_generator_py                       : latest=0.22.2, local=0.22.2
rosidl_pycommon                           : latest=4.6.7, local=4.6.7
rcl_logging_interface                     : latest=3.1.1, local=3.1.1
pluginlib                                 : latest=5.4.5, local=5.4.5
rmw_implementation_cmake                  : latest=7.3.3, local=7.3.3
type_description_interfaces               : latest=2.0.3, local=2.0.3
ros2param                                 : latest=0.32.9, local=0.32.9
rosidl_core_generators                    : latest=0.2.1, local=0.2.1
ros2run                                   : latest=0.32.9, local=0.32.9
rosidl_typesupport_interface              : latest=4.6.7, local=4.6.7
common_interfaces                         : latest=5.3.7, local=5.3.7
tcb_span                                  : latest=1.3.0, local=1.2.0
demo_nodes_cpp                            : latest=0.33.10, local=0.33.10
example_interfaces                        : latest=0.12.0, local=0.12.0
generate_parameter_library_py             : latest=0.7.1, local=0.7.1
generate_parameter_library                : latest=0.7.1, local=0.7.1
parameter_traits                          : latest=0.7.1, local=0.7.1
tl_expected                               : latest=1.3.0, local=1.2.0
image_geometry                            : latest=4.1.0, local=4.1.0
depth_image_proc                          : latest=5.0.11, local=5.0.11
image_pipeline                            : latest=5.0.11, local=5.0.11
laser_filters                             : latest=2.0.9, local=2.0.9
angles                                    : latest=1.16.1, local=1.16.1
zstd_image_transport                      : latest=4.0.7, local=4.0.6
vision_opencv                             : latest=4.1.0, local=4.1.0
compressed_image_transport                : latest=4.0.7, local=4.0.6
tracetools_image_pipeline                 : latest=5.0.11, local=5.0.11
pcl_msgs                                  : latest=1.0.0, local=1.0.0
image_publisher                           : latest=5.0.11, local=5.0.11
filters                                   : latest=2.2.2, local=2.2.2
diagnostic_updater                        : latest=4.2.6, local=4.2.6
image_view                                : latest=5.0.11, local=5.0.11
cv_bridge                                 : latest=4.1.0, local=4.1.0
perception_pcl                            : latest=2.6.4, local=2.6.4
camera_calibration                        : latest=5.0.11, local=5.0.11
theora_image_transport                    : latest=4.0.7, local=4.0.6
pcl_ros                                   : latest=2.6.4, local=2.6.4
camera_calibration_parsers                : latest=5.1.7, local=5.1.7
camera_info_manager                       : latest=5.1.7, local=5.1.7
compressed_depth_image_transport          : latest=4.0.7, local=4.0.6
stereo_image_proc                         : latest=5.0.11, local=5.0.11
perception                                : latest=0.11.0, local=0.11.0
pcl_conversions                           : latest=2.6.4, local=2.6.4
image_transport                           : latest=5.1.7, local=5.1.7
image_rotate                              : latest=5.0.11, local=5.0.11
image_transport_plugins                   : latest=4.0.7, local=4.0.6
laser_geometry                            : latest=2.7.2, local=2.7.2
image_common                              : latest=5.1.7, local=5.1.7
image_proc                                : latest=5.0.11, local=5.0.11
rosbag2_storage_mcap                      : latest=0.26.10, local=0.26.10
tf2_msgs                                  : latest=0.36.20, local=0.36.20
pybind11_vendor                           : latest=3.1.3, local=3.1.3
sqlite3_vendor                            : latest=0.26.10, local=0.26.10
liblz4_vendor                             : latest=0.26.10, local=0.26.10
rosbag2_cpp                               : latest=0.26.10, local=0.26.10
rosbag2_interfaces                        : latest=0.26.10, local=0.26.10
orocos_kdl_vendor                         : latest=0.5.1, local=0.5.1
tf2_eigen                                 : latest=0.36.20, local=0.36.20
zstd_vendor                               : latest=0.26.10, local=0.26.10
rosbag2_compression_zstd                  : latest=0.26.10, local=0.26.10
tf2_ros_py                                : latest=0.36.20, local=0.36.20
tf2_tools                                 : latest=0.36.20, local=0.36.20
rosbag2_compression                       : latest=0.26.10, local=0.26.10
rosbag2_storage                           : latest=0.26.10, local=0.26.10
keyboard_handler                          : latest=0.3.2, local=0.3.2
rosbag2_storage_default_plugins           : latest=0.26.10, local=0.26.10
tf2_bullet                                : latest=0.36.20, local=0.36.20
tf2_sensor_msgs                           : latest=0.36.20, local=0.36.20
tf2_kdl                                   : latest=0.36.20, local=0.36.20
eigen3_cmake_module                       : latest=0.3.0, local=0.3.0
tf2                                       : latest=0.36.20, local=0.36.20
urdf                                      : latest=2.10.0, local=2.10.0
sensor_msgs_py                            : latest=5.3.7, local=5.3.7
rosbag2_py                                : latest=0.26.10, local=0.26.10
rosbag2_storage_sqlite3                   : latest=0.26.10, local=0.26.10
tf2_ros                                   : latest=0.36.20, local=0.36.20
geometry2                                 : latest=0.36.20, local=0.36.20
tf2_eigen_kdl                             : latest=0.36.20, local=0.36.20
tf2_py                                    : latest=0.36.20, local=0.36.20
robot_state_publisher                     : latest=3.3.3, local=3.3.3
rosbag2                                   : latest=0.26.10, local=0.26.10
ros_base                                  : latest=0.11.0, local=0.11.0
urdf_parser_plugin                        : latest=2.10.0, local=2.10.0
rosbag2_transport                         : latest=0.26.10, local=0.26.10
message_filters                           : latest=4.11.13, local=4.11.12
yaml_cpp_vendor                           : latest=9.0.1, local=9.0.1
ros2bag                                   : latest=0.26.10, local=0.26.10
mcap_vendor                               : latest=0.26.10, local=0.26.10
tf2_geometry_msgs                         : latest=0.36.20, local=0.36.20
python_orocos_kdl_vendor                  : latest=0.5.1, local=0.5.1
kdl_parser                                : latest=2.11.0, local=2.11.0

   PLATFORM INFORMATION
system           : Linux
platform info    : Linux-5.15.167.4-microsoft-standard-WSL2-x86_64-with-glibc2.39
release          : 5.15.167.4-microsoft-standard-WSL2
processor        : x86_64

   QOS COMPATIBILITY LIST
compatibility status    : No publisher/subscriber pairs found

   RMW MIDDLEWARE
middleware name    : rmw_fastrtps_cpp

   ROS 2 INFORMATION
distribution name      : jazzy
distribution type      : ros2
distribution status    : active
release platforms      : {'debian': ['bookworm'], 'rhel': ['9'], 'ubuntu': ['noble']}

   TOPIC LIST
topic               : none
publisher count     : 0
subscriber count    : 0

Steps to reproduce issue

  1. Create test.launch.yaml bellow
  2. Run ros2 launch test.launch.yaml
  3. See console output
launch:
  - executable:
      cmd: ls
      respawn: "true"
      respawn_max_retries: ""

Expected behavior

One of the following should occur consistently:

Option 1 (preferred)
All string inputs are converted using int()
Invalid values cause a clear parse-time error
Option 2
All string is explicitly handled as:

[ERROR] [launch]: Caught exception in launch (see debug for traceback): Caught multiple exceptions when trying to load file of format [yaml]:
 - TypeError: Attribute 'respawn_max_retries' of Entity 'executable' expected to be of type '<class 'int'>', got '<class 'str'>'
 - SyntaxError: invalid syntax (sample.launch.yaml, line 1)

In all cases:

No runtime type errors should occur
Launch must remain cleanly interruptible

Actual behavior

[INFO] [launch]: All log files can be found below /home/ubuntu/.ros/log/2026-04-26-08-55-17-733269-22f9ae8fc1e5-76898
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [ls-1]: process started with pid [76903]
[INFO] [ls-1]: process has finished cleanly [pid 76903]
Task exception was never retrieved
future: <Task finished name='Task-3' coro=<ExecuteLocal.__execute_process() done, defined at /opt/ros/jazzy/lib/python3.12/site-packages/launch/actions/execute_local.py:544> exception=TypeError("'<' not supported between instances of 'str' and 'int'")>
Traceback (most recent call last):
  File "/opt/ros/jazzy/lib/python3.12/site-packages/launch/actions/execute_local.py", line 607, in __execute_process
    (self.__respawn_max_retries < 0 or
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'str' and 'int'
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[ERROR] [ls-1]: process[ls-1] failed to terminate '5' seconds after receiving 'SIGINT', escalating to 'SIGTERM'
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT) again, ignoring...
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT) again, ignoring...
[ERROR] [ls-1]: process[ls-1] failed to terminate '10.0' seconds after receiving 'SIGTERM', escalating to 'SIGKILL'
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT) again, ignoring...
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT) again, ignoring...
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT) again, ignoring...
  • Exception occurs in ExecuteLocal.__execute_process
  • Exception is not properly handled (Task exception was never retrieved)
  • Launch process becomes difficult to terminate:
    • SIGINT is repeatedly ignored
    • Requires escalation to SIGTERM/SIGKILL

Additional information

Observed inconsistency

Input type Behavior
3 (int) Converted to int → OK
"3" (string) Passed through → runtime crash
"" (string) Passed through → runtime crash
true (bool) Converted to int 1→ OK
1.5 (float) Rejected at parse time
[] (list) Rejected at parse time

Note

This issue is not about rejecting str inputs entirely, but about ensuring that the YAML frontend's implicit type conversion model is applied consistently and safely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions