ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Ros nodes don't exit as requested usually when you use threads. If you have threads running with a while
loop and you missed a condition like ros::isShuttingDown()
(or another function monitoring the ros state) then the thread will still be running even if you exit your node.
When you exit a ros node with CTRL-C
you send a signal : SIGINT
. This signal as a default timeout and if the node takes too much time to exit another signal is sent : SIGTERM
.
SIGINT
signal is an
interruption of your processes and
you are able to define functions to
handle this interruption and do
whatever you want (usually end your
threads and anything that can exit
the node).SIGTERM
signal kills all the
processes so you just end everything
without going in another function to
deal with it.With Gazebo
it's a common issue. To run, Gazebo
needs the process gzserver
.
FYI : There is also the process gzclient
used for the Gazebo GUI
. You can run Gazebo
without gzclient
, you just won't have the GUI
but if you check in Rviz everything will work.Instead of gzserver
which is mandatory.
The problem here is that gzserver
takes a lot of time to exit when you send a SIGINT
signal (I don't know why though). The default timeout is 15.0 seconds
so after that time you have the SIGTERM
signal sent to exit gzserver
. I use a workaround thanks to #q11353 to change the default timeout of the signals. In the file :
/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/nodeprocess.py
You can modify this line to the value you want (not too low to allow other nodes to exit cleanly)
_TIMEOUT_SIGINT = 15.0 #seconds
You can also try to increase this value to see how much time it takes to actually exit cleanly if you want.
2 | No.2 Revision |
Ros nodes don't exit as requested usually when you use threads. If you have threads running with a while
loop and you missed a condition like ros::isShuttingDown()
(or another function monitoring the ros state) then the thread will still be running even if you exit your node.node (in that case i use the commands jobs
to check the processes running and kill them with kill %1
).
When you exit a ros node with CTRL-C
you send a signal : SIGINT
. This signal as a default timeout and if the node takes too much time to exit another signal is sent : SIGTERM
.
SIGINT
signal is an
interruption of your processes and
you are able to define functions to
handle this interruption and do
whatever you want (usually end your
threads and anything that can exit
the node).SIGTERM
signal kills all the
processes so you just end everything
without going in another function to
deal with it.With Gazebo
it's a common issue. To run, Gazebo
needs the process gzserver
.
FYI : There is also the process gzclient
used for the Gazebo GUI
. You can run Gazebo
without gzclient
, you just won't have the GUI
but if you check in Rviz everything will work.Instead of gzserver
which is mandatory.
The problem here is that gzserver
takes a lot of time to exit when you send a SIGINT
signal (I don't know why though). The default timeout is 15.0 seconds
so after that time you have the SIGTERM
signal sent to exit gzserver
. I use a workaround thanks to #q11353 to change the default timeout of the signals. In the file :
/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/nodeprocess.py
You can modify this line to the value you want (not too low to allow other nodes to exit cleanly)
_TIMEOUT_SIGINT = 15.0 #seconds
You can also try to increase this value to see how much time it takes to actually exit cleanly if you want.
3 | No.3 Revision |
Ros nodes don't exit as requested usually when you use threads. If you have threads running with a while
loop and you missed a condition like ros::isShuttingDown()
(or another function monitoring the ros state) then the thread will still be running even if you exit your node (in that case i use the commands jobs
to check the processes running and kill them with kill %1
).
When you exit a ros node with CTRL-C
you send a signal : SIGINT
. This signal as has a default timeout and if the node takes too much time to exit another signal is sent : SIGTERM
.
SIGINT
signal is an
interruption of your processes and
you are able to define functions to
handle this interruption and do
whatever you want (usually end your
threads and anything that can exit
the node).SIGTERM
signal kills all the
processes so you just end everything
without going in another function to
deal with it.With Gazebo
it's a common issue. To run, Gazebo
needs the process gzserver
.
FYI : There is also the process gzclient
used for the Gazebo GUI
. You can run Gazebo
without gzclient
, you just won't have the GUI
but if you check in Rviz everything will work.Instead of gzserver
which is mandatory.
The problem here is that gzserver
takes a lot of time to exit when you send a SIGINT
signal (I don't know why though). The default timeout is 15.0 seconds
so after that time you have the SIGTERM
signal sent to exit gzserver
. I use a workaround thanks to #q11353 to change the default timeout of the signals. In the file :
/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/nodeprocess.py
You can modify this line to the value you want (not too low to allow other nodes to exit cleanly)
_TIMEOUT_SIGINT = 15.0 #seconds
You can also try to increase this value to see how much time it takes to actually exit cleanly if you want.