ros2 / ros2/launch

No error information provided when using frontend launch files

Open
#412 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Python
Stars
155
Forks
182
Avg merge
2d 14h
Merged PRs (30d)
6

Description

Bug report

This is not actually a bug but rather important missing functionality.

Required Info:

  • Operating System: Ubuntu 18.04
  • Installation type: Eloquent from binaries, launch from source
  • Version or commit hash: cac43b195fb767128df1fdf494687973d538c792 (launch)
Steps to reproduce issue

Invalid launch xml file, e.g.:

<?xml version="1.0"?>
<launch>
  <node />
</launch>
Expected behavior

Some information provided about what line or tag caused a problem when loading the file. I would expect this to be provided as clean formatted output and not in a huge python traceback.

Actual behavior

A generic exception is thrown that the launch file is invalid and ros2 launch immediately terminates.

[DEBUG] [launch.launch_context]: emitting event synchronously: 'launch.events.IncludeLaunchDescription'
[DEBUG] [launch.launch_context]: emitting event synchronously: 'launch.events.IncludeLaunchDescription'
[INFO] [launch]: Default logging verbosity is set to DEBUG
[DEBUG] [launch]: processing event: '<launch.events.include_launch_description.IncludeLaunchDescription object at 0x7fb1dc627438>'
[DEBUG] [launch]: processing event: '<launch.events.include_launch_description.IncludeLaunchDescription object at 0x7fb1dc627438>' ✓ '<launch.event_handlers.on_include_launch_description.OnIncludeLaunchDescription object at 0x7fb1d2119710>'
[DEBUG] [launch]: processing event: '<launch.events.include_launch_description.IncludeLaunchDescription object at 0x7fb1cdd67588>'
[DEBUG] [launch]: processing event: '<launch.events.include_launch_description.IncludeLaunchDescription object at 0x7fb1cdd67588>' ✓ '<launch.event_handlers.on_include_launch_description.OnIncludeLaunchDescription object at 0x7fb1d2119710>'
[DEBUG] [launch]: Traceback (most recent call last):
File "/home/jlangsfeld/Workspaces/ros2/build/launch/launch/launch_service.py", line 362, in run_async
await process_one_event_task
File "/usr/lib/python3.6/asyncio/coroutines.py", line 126, in send
return self.gen.send(value)
File "/home/jlangsfeld/Workspaces/ros2/build/launch/launch/launch_service.py", line 273, in _process_one_event
await self.__process_event(next_event)
File "/usr/lib/python3.6/asyncio/coroutines.py", line 110, in next
return self.gen.send(None)
File "/home/jlangsfeld/Workspaces/ros2/build/launch/launch/launch_service.py", line 293, in __process_event
visit_all_entities_and_collect_futures(entity, self.__context))
File "/home/jlangsfeld/Workspaces/ros2/build/launch/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
File "/home/jlangsfeld/Workspaces/ros2/build/launch/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
File "/home/jlangsfeld/Workspaces/ros2/build/launch/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 38, in visit_all_entities_and_collect_futures
sub_entities = entity.visit(context)
File "/home/jlangsfeld/Workspaces/ros2/build/launch/launch/action.py", line 108, in visit
return self.execute(context)
File "/home/jlangsfeld/Workspaces/ros2/build/launch/launch/actions/include_launch_description.py", line 125, in execute
launch_description = self.__launch_description_source.get_launch_description(context)
File "/home/jlangsfeld/Workspaces/ros2/build/launch/launch/launch_description_source.py", line 84, in get_launch_description
self._get_launch_description(self.__expanded_location)
File "/home/jlangsfeld/Workspaces/ros2/build/launch/launch/launch_description_sources/any_launch_description_source.py", line 53, in _get_launch_description
return get_launch_description_from_any_launch_file(location)
File "/home/jlangsfeld/Workspaces/ros2/build/launch/launch/launch_description_sources/any_launch_file_utilities.py", line 56, in get_launch_description_from_any_launch_file
raise InvalidLaunchFileError(extension, likely_errors=exceptions)
launch.invalid_launch_file_error.InvalidLaunchFileError: The launch file may have a syntax error, or its format is unknown

[ERROR] [launch]: Caught exception in launch (see debug for traceback): The launch file may have a syntax error, or its format is unknown
[DEBUG] [launch.launch_context]: emitting event: 'launch.events.Shutdown'
[DEBUG] [launch]: processing event: '<launch.events.shutdown.Shutdown object at 0x7fb1c5be12e8>'
[DEBUG] [launch]: processing event: '<launch.events.shutdown.Shutdown object at 0x7fb1c5be12e8>' ✓ '<launch.event_handlers.on_shutdown.OnShutdown object at 0x7fb1c5bbc128>'
[DEBUG] [launch]: processing event: '<launch.events.shutdown.Shutdown object at 0x7fb1c5be12e8>' ✓ '<launch.event_handlers.on_shutdown.OnShutdown object at 0x7fb1da7f6a90>'

Additional information

The same exception is also thrown when you do have a valid XML frontend file but don't happen to have the launch_xml package installed. It's a really terrible user experience that no information is provided at all about what the problem is.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the invalid XML example and a valid XML file without the launch_xml package. Read launch/launch/launch_description_sources/any_launch_file_utilities.py and launch/launch/invalid_launch_file_error.py, then trace the reported launch_description_sources path. Done means frontend errors identify the likely syntax or missing-package cause in clean output instead of only a generic message and traceback.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.