ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Unable to kill rosnode running in background

asked 2015-06-19 16:42:15 -0500

tosandip gravatar image

I killed my_node using

rosnode kill my_node

When printing a list of nodes

rosnode list

my_node is not showing up the nodes, but it is running in the background and I confirmed it using the following command:

ps aux | grep my_node | grep -v grep | awk '{print $2}'

This shows a list of my_node, because I started the my_node many times.

kill $(ps aux | grep my_node | grep -v grep | awk '{print $2}')

Is not killing any of the nodes

I have tried, pkill as well without any luck. Only way to get out of this issue is to restart roscore

I would like to know if there is any other way to kill the node?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2015-06-20 17:52:18 -0500

ahendrix gravatar image

It's quite likely that your node is stuck in an infinite loop somewhere or is never initializing ROS.

Usually, kill sends SIGINT, which can be caught by the process so that it can terminate gracefully. It sounds like your process is stuck somehow, and this signal is caught and ignored.

You can also tell kill to send the SIGKILL signal, which cannot be caught and causes your program to terminate immediately. You can tell kill to send the SIGKILL by name: kill -KILL or by number kill -9

Once you've cleared out any runaway processes, you should go through your code and try to understand why it's getting stuck; otherwise they'll just keep running away from you.

edit flag offensive delete link more

Comments

Thanks that helped.

tosandip gravatar image tosandip  ( 2015-06-22 08:36:37 -0500 )edit

Question Tools

Stats

Asked: 2015-06-19 16:42:15 -0500

Seen: 2,345 times

Last updated: Jun 20 '15