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

How do you kill the "zombie" node in ROS2 on local?

asked 2021-04-28 07:53:17 -0500

kak13 gravatar image

I've programmed the publisher to create "/scan" however. that is the grave mistake. After close all ros2 applications, I noticed the /scan still running even if there is nothing runs it. It's basically zombie now.

I've trying to get rid of it but there is nothing to see. Jobs, fg, and bg return nothing.

I found another post however the OP was using the docker. I did not. How do you kill the zombie node?

edit retag flag offensive close merge delete


You may be confusing the concepts of 'node' and 'topic'. Could you show what you do to see that '/scan is still running'? Are you using ros2 topic list maybe? Or do you see it in RQT or Rviz? What do you get when you run ros2 topic info /range? And how did you start the node that publishes on /scan, using ros2 run, or ros2 launch perhaps?

sgvandijk gravatar image sgvandijk  ( 2021-04-28 11:56:59 -0500 )edit

Hi, Sorry for the delay reply!

I thought the topic is the name of something to run and sends/receives information which is considered as a node?

I used ros2 topic list and I see it running as /scan. The /scan comes from the file where I had the publisher to pretend like as if it's "/scan". I checked and there is no one running it.

I ran the ros2 run publisher test.

After 5 hours later, it's gone. I'm not sure now.

I will definitely check the ros2 topic info /scan when it happens again. I don't know how to get it doing the same thing again, to be honest.

There is one thing I know for sure is that restart pc would fix this issue lol

kak13 gravatar image kak13  ( 2021-04-29 07:22:06 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-04-29 10:02:41 -0500

sgvandijk gravatar image

updated 2021-05-05 04:14:48 -0500

A node is a process that performs some form of logic as part of your full robot control system, a topic is an interface through which multiple nodes can communicate. A node can publish and subscribe to any number of topics, and any number of nodes can publish and subscribe to a single topic (though it's more common that only a single node is responsible for publishing on a topic).

This also implies that a topic can exist separately from any node that contains a publisher for it. If there is an active subscription to the topic but nobody is publishing on it, then the topic will also still show up in ros2 topic list. For instance if you run ros2 topic echo foo std_msgs/msg/Bool, then in another terminal run ros2 topic list, then you will see the /foo topic even though nobody has ever published anything on it! The output of ros2 topic info /foo will show that, telling you that there is 1 subscription but 0 publishers:

$ ros2 topic info /foo
Type: std_msgs/msg/Bool
Publisher count: 0
Subscription count: 1

Adding the -v flag will give more output about the possible publishers or subscriptions:

$ ros2 topic info /foo -v
Type: std_msgs/msg/Bool

Publisher count: 0

Subscription count: 1

Node name: _ros2cli_340
Node namespace: /
Topic type: std_msgs/msg/Bool
Endpoint type: SUBSCRIPTION
GID: 01.0f.3e.
QoS profile:
  Lifespan: 2147483651294967295 nanoseconds
  Deadline: 2147483651294967295 nanoseconds
  Liveliness lease duration: 2147483651294967295 nanoseconds

So this says that the subscription comes the node _ros2cli_340, which is the name picked by the ros2 echo command.

This situation also could happen if you run RQT or Rviz to monitor or visualize a topic, then kill the publishing node: they keep their subscription and the topic still exists.

Another situation I have seen in the past is if the publisher is run on another machine (your robot) and you run ros2 topic list on another machine connected to the same network (your laptop), then when you kill the publisher it may take a while for your machine to notice that the topic is gone, even without any subscription to it.

So all that is to say that if you see a topic, it doesn't necessarily mean you have a zombie process publishing to it. To figure out what is happening I would:

  • run ros2 topic info /topic -v to see if there is either a publisher or a subscription and what their name is, which could help determining where to look for it.
  • maybe run ros2 node list -a to help further to understand all the nodes that are running
  • Finally if that doesn't give anything or your not able to find where they are running (which shouldn't happen easily if you just use ros2 run and ctl+c in terminals to ...
edit flag offensive delete link more


This is very helpful! Thank you!!!

kak13 gravatar image kak13  ( 2021-05-05 04:06:30 -0500 )edit

Question Tools



Asked: 2021-04-28 07:53:17 -0500

Seen: 2,301 times

Last updated: May 05 '21