rclpy: Sigint cannot kill python talker run by bash in background mode

Bug report

I write a bash script to run a python talker program in background, then send sigint to the talker process. The weird thing is that the python talker cannot be killed by sigint. But the cpp talker can be killed.

The same issue was also proposed in https://github.com/ros2/ros2/issues/883. As I suppose this could be a rclpy bug, so I propose it here. Required Info:

  • Operating System:
    • Ubuntu 18.04
  • Installation type:
    • binaries
  • Version or commit hash:
    • foxy
  • DDS implementation:
    • Fast-RTPS
  • Client library (if applicable):
    • rclpy

Steps to reproduce issue

test.bash file:
# For python test:
python3 /opt/ros/foxy/lib/python3.6/site-packages/demo_nodes_py/topics/talker.py &

# For cpp test:
#../opt/ros/foxy/lib/demo_nodes_cpp/talker &

In terminal:

  1. bash test.bash
  2. find the talker pid, and kill -2 talker_pid

Expected behavior

cpp test: talker is killed. python test: talker is killed.

Actual behavior

cpp test: talker is killed. python test: talker continues running.

Additional information


Feature request

Feature description

Implementation considerations

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 17 (16 by maintainers)

Most upvoted comments

That sounds better to me, since that’s exactly what rclcpp does.