Sigint cannot kill python talker run by bash in background mode
See original GitHub issueBug 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:
- bash test.bash
- 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
Issue Analytics
- State:
- Created 3 years ago
- Comments:17 (16 by maintainers)
Top Results From Across the Web
How to send a SIGINT to Python from a bash script?
Since loop.py is sent to background, there's no guarantee that kill runs after python loop.py. #! /bin/bash python loop.py & PID=$! # #...
Read more >Prevent SIGINT from interrupting function call and child ...
To tell the shell to run background jobs in a separate process ... be run as a service with the appropriate kill mode...
Read more >How To Use Bash's Job Control to Manage Foreground and ...
Once a job is in the foreground, you can kill it with CTRL + C , let it complete, or suspend and move...
Read more >Bash Job Control - Cindy Sridharan - Medium
It's also possible to run a process in the background. Background processes don't restrict access to the shell but execute in the background...
Read more >graceful job termination - Jenkins Jira
Using the freestyle projects to execute bash shell scripts work fine. ... is killed and Jenkins is done, go to the terminal and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That sounds better to me, since that’s exactly what rclcpp does.
I think that imitating the
rclcpp
behavior inrclpy
is ok.What I mean is that making that change can generate random errors in places were that didn’t happen, and I would rather fix the async shutdown behavior before making a change here.