-
Couldn't load subscription status.
- Fork 158
Description
Bug report
Required Info:
- Operating System:
- DISTRIB_ID=Ubuntu
- DISTRIB_RELEASE=20.04
- DISTRIB_CODENAME=focal
- DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
- Installation type:
- binaries
- Version or commit hash:
- ros-foxy-ros2launch 0.10.3-1focal.20201008.001853
- DDS implementation:
- Fast-RTPS
Steps to reproduce issue
Any rarely logging binary/script, e.g. /tmp/simple_script.bash:
#!/usr/bin/env bash
sleep 20
echo 'Hello'
sleep 20
A launch file /tmp/simple.launch.py:
from launch import LaunchDescription
import launch.actions
def generate_launch_description():
return LaunchDescription([
launch.actions.ExecuteProcess(cmd=['/tmp/simple_script.bash'], output='screen')
])
Run the launch file with debug option:
ros2 launch -d /tmp/simple.launch.py
In separate terminal tab send SIGINT to launcher process:
pkill -2 ros2
Expected behavior
In best case I expect launcher would forward SIGINT to my bash subprocess and both processes terminate gracefully. At least I expect launcher would terminate in finite time.
Actual behavior
Nothing happens until subprocess echoes. Looks like Shutdown event stuck in queue. In the log below you can see there's about 19 second between emitting Shutdown event and processing one:
1605703730.0072842 [DEBUG] [launch.launch_context]: emitting event synchronously: 'launch.events.IncludeLaunchDescription'
1605703730.0082226 [INFO] [launch]: All log files can be found below /home/user/.ros/log/2020-11-18-12-48-49-887166-27703d5967b1-7901
1605703730.0083606 [INFO] [launch]: Default logging verbosity is set to DEBUG
1605703730.0106397 [DEBUG] [launch]: processing event: '<launch.events.include_launch_description.IncludeLaunchDescription object at 0x7f462fc195b0>'
1605703730.0108380 [DEBUG] [launch]: processing event: '<launch.events.include_launch_description.IncludeLaunchDescription object at 0x7f462fc195b0>' ✓ '<launch.event_handlers.on_include_launch_description.OnIncludeLaunchDescription object at 0x7f462fc28e80>'
1605703730.0200140 [INFO] [simple_script.bash-1]: process started with pid [7903]
1605703730.0203502 [DEBUG] [launch.launch_context]: emitting event: 'launch.events.process.ProcessStarted'
1605703730.0207794 [DEBUG] [launch]: processing event: '<launch.events.process.process_started.ProcessStarted object at 0x7f463042ccd0>'
1605703731.6404905 [WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
1605703731.6411691 [DEBUG] [launch.launch_context]: emitting event synchronously: 'launch.events.Shutdown'
1605703750.3496287 [DEBUG] [launch]: processing event: '<launch.events.shutdown.Shutdown object at 0x7f46304a48e0>'(8)
1605703750.3498898 [DEBUG] [launch]: processing event: '<launch.events.shutdown.Shutdown object at 0x7f46304a48e0>' ✓ '<launch.event_handlers.on_shutdown.OnShutdown object at 0x7f462fb29100>'
1605703750.3528886 [DEBUG] [launch]: processing event: '<launch.events.shutdown.Shutdown object at 0x7f46304a48e0>' ✓ '<launch.event_handlers.on_shutdown.OnShutdown object at 0x7f462fc82550>'
1605703750.3548706 [DEBUG] [launch.launch_context]: emitting event synchronously: 'launch.events.process.ProcessStdout'
1605703750.3557782 [DEBUG] [launch]: processing event: '<launch.events.process.process_stdout.ProcessStdout object at 0x7f462fb29d90>'
1605703750.3559816 [DEBUG] [launch]: processing event: '<launch.events.process.process_stdout.ProcessStdout object at 0x7f462fb29d90>' ✓ '<launch.event_handlers.on_process_io.OnProcessIO object at 0x7f462fb290d0>'
1605703755.3556085 [DEBUG] [launch.launch_context]: emitting event: 'launch.events.TimerEvent'
1605703755.3560567 [DEBUG] [launch]: processing event: '<launch.events.timer_event.TimerEvent object at 0x7f462fcd1490>'
1605703755.3564785 [DEBUG] [launch]: processing event: '<launch.events.timer_event.TimerEvent object at 0x7f462fcd1490>' ✓ '<launch.event_handler.EventHandler object at 0x7f462fb29f70>'
1605703755.3568366 [ERROR] [simple_script.bash-1]: process[simple_script.bash-1] failed to terminate '5' seconds after receiving 'SIGINT', escalating to 'SIGTERM'
1605703755.3571658 [DEBUG] [launch.launch_context]: emitting event synchronously: 'launch.events.process.SignalProcess'
1605703755.3583355 [DEBUG] [launch]: processing event: '<launch.events.process.signal_process.SignalProcess object at 0x7f462fb29a90>'
1605703755.3584905 [DEBUG] [launch]: processing event: '<launch.events.process.signal_process.SignalProcess object at 0x7f462fb29a90>' ✓ '<launch.event_handler.EventHandler object at 0x7f462fb29070>'
1605703755.3588274 [INFO] [simple_script.bash-1]: sending signal 'SIGTERM' to process[simple_script.bash-1]
1605703755.3613477 [ERROR] [simple_script.bash-1]: process has died [pid 7903, exit code -15, cmd '/tmp/simple_script.bash'].
1605703755.3616023 [DEBUG] [launch.launch_context]: emitting event: 'launch.events.process.ProcessExited'
1605703755.3632402 [DEBUG] [launch]: processing event: '<launch.events.process.process_exited.ProcessExited object at 0x7f462fcd1490>'(9)
1605703755.3634789 [DEBUG] [launch]: processing event: '<launch.events.process.process_exited.ProcessExited object at 0x7f462fcd1490>' ✓ '<launch.event_handlers.on_process_exit.OnProcessExit object at 0x7f462fb291f0>'
1605703755.3637152 [DEBUG] [launch]: processing event: '<launch.events.process.process_exited.ProcessExited object at 0x7f462fcd1490>' ✓ '<launch.event_handlers.on_process_exit.OnProcessExit object at 0x7f462fb29130>'
Additional information
This behaviour is not observed when sending SIGINT with Ctrl+C in terminal, since TTY machinery sends signal to the whole process group and subprocesses terminate without parent's help.
In my case I tried to run ros2 launch in docker container. docker stop sends specified signal only to parent process.