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

Roscore force unregister of node that died

asked 2018-09-18 13:23:58 -0500


I believe I'm running into a situation in a multi machine setup.


  1. Machine running rosmaster
  2. Second machine that's properly setup to recognize the machine running roscore

What I believe I'm observing sometimes is that if I forcibly kill the second machine (for example, disconnect the power), since the ros::shutdown() is not called the roscore still thinks that the node is there and lists it.

Is there any way I can force roscore to kill the topic that is connected to the node that doesn't exist anymore?

Since I'm using anonymous node names (and I have to do it in my case) is that if I forcibly reset my slave computer I will end up with a rosnode list showing two topics, one of which is not connected to anything.

Any tips how to handle it neatly would be highly appreciated!

edit retag flag offensive close merge delete


rosmaster doesn't have any timeout for nodes if they crash, so it will keep remembering them until a new node starts with the same name. I'm pretty sure this isn't a new issue, but I can't find a bug report for it.

ahendrix gravatar image ahendrix  ( 2018-09-18 14:16:52 -0500 )edit

Related Q&As: #q9521 and #q285530.

gvdhoorn gravatar image gvdhoorn  ( 2018-09-18 15:23:07 -0500 )edit

rosnode cleanup should do the trick.

Choco93 gravatar image Choco93  ( 2018-09-19 01:21:37 -0500 )edit

Thanks for the helpful comments! I figured a better approach than force unregistering the node. Instead in my case it's sufficient to use node_alive and keep track of alive nodes

msadowski gravatar image msadowski  ( 2018-10-04 02:27:20 -0500 )edit

Wondering how this compares to bond (at least in C++).

gvdhoorn gravatar image gvdhoorn  ( 2018-10-04 02:31:37 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-10-04 02:37:16 -0500

After thinking about it for some time and doing some experiments I decided unregistering a node is a bad idea in my case (it seems you can create quite a lot of trouble if a node is not available because for example the network is down for a second).

What I found to be a great alternative without a brute force approach is node_alive package that allows me to keep track of nodes that are see as alive. Then I can use this information to keep track of 'pingable' nodes and use them accordingly in my setup.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-09-18 13:23:58 -0500

Seen: 648 times

Last updated: Oct 04 '18