NEWAI chat: ask your fleet anything, in plain language. Chat with your fleet Read more →

How to detect a ROS 2 node that silently stopped publishing

Why a ROS 2 node can look alive while its topic goes quiet, how to catch it by hand and in code, and how to alert on silence across a robot fleet.

Illustration for "When a ROS 2 topic goes quiet": a robot arm, a camera, the PhysicalFleet hub, with the label "/wrist_cam · silent 40 min"

Late on a night shift at a customer site, a picking arm has been standing still for forty minutes. Everything you can check says it's fine. The container is running. systemd says the service is active. ros2 node list shows every node you expect, including the wrist camera driver. Nobody gets paged, because nothing failed.

But the last message on /wrist_cam/image_raw arrived forty minutes ago. The driver is still registered in the graph. It just stopped sending images. The policy downstream is waiting for a frame that will never come, and the operator on site thinks the robot is waiting for parts.

This is the ROS 2 failure I'd worry about most, because nothing in a normal stack reports it. A crash is loud: the process exits, systemd restarts it, a log line says why. A node that stays and says nothing produces no log line at all.

It matters more than it used to. A robot running a learned policy is a living mind: a model decides many times a second from what the cameras and joints report, the model and the site keep changing, and the robot runs far from the person who could notice. When an input goes quiet, the policy has nothing new to decide from. Whatever it does next, waiting or repeating, it does without telling anyone why.

The short answer: A node being up tells you nothing about its data. Measure the time since the last message on every topic that normally flows at a steady rate, and alert when it has been silent for several times that topic's own usual gap. On one robot, ros2 topic hz and ros2 topic info -v tell you which kind of silence you have; in code, a QoS deadline on the subscription reports it. Treat silence as its own alert, separate from crashes and low rates.

Why "the node is up" means so little

ros2 node list shows what DDS discovery knows (through the ros2 daemon's cached view; add --no-daemon to ask the network directly). A node stays in that list as long as its process keeps taking part in discovery, and that work happens in middleware threads, not in your callbacks. So a node can be fully present in the graph while the code that's supposed to publish hasn't run for an hour.

These are the ways I've seen a topic go quiet while everything else looked green.

A callback is blocked

A ROS 2 executor runs your timers and subscription callbacks. The executors documentation says callbacks in a mutually exclusive callback group must not run in parallel, and a plain spin(node) runs everything on a single thread. So if one callback blocks, the timer that publishes your topic never fires again.

What blocks it in real life:

  • A synchronous service call from inside a callback, waiting for a response that the same executor would have to deliver.
  • A lock taken in one callback and never released because another path threw an exception while holding it.
  • A blocking read with no timeout: a socket, a serial port, an HTTP request to an inference server that stopped answering.

The node is alive and uses almost no CPU. Low CPU plus no output usually means it's waiting, not working.

The driver is stuck on hardware

A USB camera disconnects for half a second because a cable moved during a fast motion, and comes back with a new device number. The driver keeps trying the old one. Same with a serial motor bus after a brownout, or an I2C sensor that stopped answering. Often the driver is looping on read errors it logged once, an hour ago. Sometimes it's blocked in the kernel. Either way, nothing in ROS knows.

A lifecycle node is inactive

Managed (lifecycle) nodes have four primary states: unconfigured, inactive, active and finalized. A lifecycle publisher only sends messages while its node is active. The lifecycle demo shows what happens otherwise: the node logs that the publisher is inactive and messages are not published. The node is in ros2 node list, and its publisher still counts. It's simply not active, maybe because a supervisor deactivated it after an error and never brought it back.

Something upstream went quiet

Many nodes only publish when they receive input. A detector publishes when an image arrives. A policy publishes actions when it gets an observation. If the camera stops, the detector stops, and the action topic stops. Three topics went silent, but only one of them is the cause. Find the first silent topic in the chain, not the loudest symptom.

The process is stopped

Someone attached a debugger on site and forgot about it, or the process got a stop signal. This one looks different: a stopped process stops its DDS threads too, so after its discovery lease runs out the node disappears from the graph while the process is still there. "Node gone, process alive" is its own signal, and it's not a crash.

Then there's the case where the publisher is fine and you just don't hear it: incompatible QoS, shared memory not shared between containers, a domain ID mismatch. We covered those traps in how to monitor ROS 2 across a fleet of robots. Establish early whether the publisher stopped or you stopped hearing it.

Silence is not a low rate

This is the trap I see most often. Teams add an alert like "camera rate below 20 Hz for 1 minute" and assume silence is covered, because zero is below 20.

It often isn't. A rate is computed from messages. When messages stop, many pipelines stop producing rate samples at all, instead of producing zeros. A threshold rule over no data has nothing to evaluate, so it stays quiet. The alert that was supposed to catch the worst case catches only the mild one.

So measure silence directly:

  • Track the age of the last message, per topic. That number keeps growing when nothing arrives, which is exactly the property you need.
  • Learn each topic's usual gap. A camera at 30 Hz has a gap of about 33 ms. A battery state topic at 1 Hz has a gap of a second. One global timeout is wrong for both.
  • Alert at a multiple of the usual gap, with a floor. The multiple absorbs normal jitter. A floor of ten seconds or so keeps a 1 kHz topic from paging you over a scheduling hiccup.
  • Only judge topics with a rhythm. Some topics publish on change: a goal, an event, a map, the robot description. Silence there is normal. Classify topics by how they behave before you judge them, or you'll train everyone to ignore the alert.
  • Separate "silent" from "I can't see the robot". If the thing watching the topics is offline, every topic looks silent. The watcher has to report its own health, so missing data is explained rather than mistaken for a stopped node.

Checking one robot by hand

When you're on a single robot and a topic looks dead, this is the order I check in. The ROS commands are from the Jazzy CLI (ros2topic source).

ros2 topic hz /wrist_cam/image_raw -w 50 # is anything arriving at all?

ros2 topic info -v /wrist_cam/image_raw # publisher count and QoS of each side

ros2 node list --no-daemon # is the publishing node still in the graph?

ros2 lifecycle get /wrist_cam_driver # managed node: active or inactive?

ps -L -o tid,stat,wchan:32,comm -p <pid> # every thread: S, D (kernel wait), T or t (stopped)

sudo py-spy dump --pid <pid> # Python node: where is each thread waiting?

sudo gdb -p <pid> -batch -ex "thread apply all bt" # C++ node: the same, from gdb

How to read the answers:

  1. Publisher count is 0 and the node is gone. Check whether the process is alive. If it is, it's stopped or stuck, not crashed.
  2. Publisher count is 0 and the node is listed. The node destroyed its publisher, often in an error path. Its logs from that moment will say more than anything now.
  3. Publisher count is 1 and `hz` shows nothing. The publisher exists and isn't sending. Check the lifecycle state first; it's the cheapest answer. Then look at the threads.
  4. A thread shows D. It's waiting in the kernel, usually on storage or a device. Read the kernel log around the time the topic went quiet.
  5. T or t. Something stopped the process, or a debugger is attached (t). Find out what before you resume it.
  6. All threads show S. It's waiting on something in user space. py-spy dump prints each Python thread's stack, and gdb does the same for C++; the blocking call is usually right there. Attaching needs root, and inside Docker py-spy may fail because the container blocks the system call it uses, so run it from the host.
  7. Reliability, durability or deadline are incompatible between the two sides. That's a receiving problem, not a silent node. Look in /rosout for an incompatible QoS warning.

Let the node tell you, too

ROS 2 has built-in ways for a node to report silence.

QoS deadline. The QoS documentation defines the deadline as the expected maximum time between messages on a topic. A subscription that sets one gets a "requested deadline missed" event when nothing arrives in time; a publisher that offers one gets "offered deadline missed" when it fails to publish in time. Here's a subscriber on the camera, in the style of the official deadline demo:

from copy import copy

from rclpy.duration import Duration

from rclpy.event_handler import SubscriptionEventCallbacks

from rclpy.qos import qos_profile_sensor_data

from sensor_msgs.msg import Image

def on_deadline(event):

node.get_logger().error(f"wrist_cam silent: {event.total_count} deadlines missed")

qos = copy(qos_profile_sensor_data) # best effort, like most camera drivers

qos.deadline = Duration(seconds=0.2)

cbs = SubscriptionEventCallbacks(deadline=on_deadline)

node.create_subscription(Image, "/wrist_cam/image_raw", on_image, qos, event_callbacks=cbs)

One catch: a deadline is part of the QoS contract. The publisher must offer a deadline equal to or shorter than the one the subscription requests, or the two don't connect at all. A driver with the default (no deadline) won't match this subscriber. So this works for nodes you own on both sides; for a third-party driver, set its publisher's deadline through its parameters if it allows that, or watch the topic from outside.

Liveliness. With automatic liveliness, the documentation says all of a node's publishers count as alive when any one of them has published. One healthy topic hides a quiet one on the same node. For "is this topic flowing", the deadline is the better tool.

diagnostic_updater. If your drivers publish /diagnostics, the diagnostic_updater package has FrequencyStatus and DiagnosedPublisher, which check a publisher's rate against a minimum and maximum with a tolerance. When no events were recorded in the window, the status is ERROR with "No events recorded."

The limit of all three: they run inside the robot's own processes. If the node that should report the miss is the one that's stuck, it reports nothing. In-process checks are good for fast local reactions, like a controller stopping motion when its command topic goes stale. You still need a watcher outside the process that judges every topic the same way.

Across a fleet: what to put in place

On one robot, a person runs the commands above. On fifty robots, nobody notices the silence in the first place. Before the second site goes live, I'd have:

  • A watcher outside your ROS processes on every robot, so a hung node can't hang it, reporting its own health.
  • Per-topic rhythm learned on each robot. The usual gap per topic, per robot. Topics without a rhythm left alone.
  • Three separate signals: a node that left the graph (and whether its process is still there), a topic that went silent, and a topic that slowed down against its own baseline. Different causes, different owners.
  • Evidence captured when it happens. Silence is often fixed by a restart before anyone looks, and the restart erases the clues. Keep the last few minutes of logs, /rosout, metrics and a camera frame, and save them when a topic goes quiet. That's what a flight recorder for robots is for.
  • The change timeline next to it. Package upgrades, config edits, reboots, a new model version. Often, "it stopped by itself" turns out to be "it stopped after something changed".
  • QoS deadlines on the topics your controller and policy can't live without, for the fast local reaction.

If one robot's driver goes quiet every afternoon and its peers never do, look at that robot before the code; more on that in finding the robot that's different.

How we do it at PhysicalFleet

Our agent watches ROS 1 and ROS 2 from outside your processes, with nothing added to your workspace, and it never publishes. It learns each topic's rhythm, reports a topic that stopped (silent for several times its usual gap) and when it flows again, leaves topics sent only on change alone, and reports a node that left the ROS network while its process is still there, with that process's state. On-device diagnosis names the likely cause, such as a lost publisher, a process stopped or blocked on I/O, or a change in the hour before, and the minutes around it are saved as a flight recording. More on the observability page.

If you've chased a silent node on a robot far away, I'd like to hear what it turned out to be.

Common questions

How do I detect a topic timeout in ROS 2?

In code, set a QoS deadline on the subscription and register a deadline callback; it fires when no message arrives within the deadline. The publisher has to offer a deadline equal or shorter, or they won't connect. For topics you don't control, watch the age of the last message from outside the node and alert at a multiple of the topic's usual gap.

Why does ros2 node list show a node that has stopped working?

Because the list reflects DDS discovery, which runs in middleware threads, not in your callbacks. A node with a blocked callback, a driver looping on errors, or an inactive lifecycle state stays in the graph while publishing nothing. Check the topic's rate and the process's threads, not just the node list.

What is the difference between QoS deadline and liveliness in ROS 2?

A deadline is the expected maximum time between messages on one topic, and missing it raises an event on each side that set one. Liveliness tells you whether a publisher is still alive; with automatic liveliness, any publisher of a node publishing keeps all of that node's publishers alive. To detect a single quiet topic, use the deadline.

Does a lifecycle node publish when it's inactive?

No. A lifecycle publisher only sends messages while its node is active; while inactive, messages are not published, even though the node and its publisher still appear in the graph. If a managed node's topic is silent, run ros2 lifecycle get on it first.

How long should a ROS 2 topic be silent before I alert?

Base it on each topic's own rhythm rather than one global timeout. A multiple of the usual gap between messages, with a floor of around ten seconds, ignores normal jitter on fast topics and still catches a 1 Hz topic that stopped. Topics that publish only on change should not get a silence alert at all.

#ROS 2#topic monitoring#stale topics#QoS deadline#lifecycle nodes#robot observability
Amit EzerCo-founder, PhysicalFleet

From the lab bench. To the entire fleet.

Connect your first machine in minutes, develop it in the lab and run your whole fleet in production from one place.

Free for up to 3 machines · Then pay as you go