Work record: , 5 minute read

Killing a process tree the launcher wouldn't forward signals to

Two bench attempts missed the stop failure. A controlled process fixture exposed the reparenting case: children survived because the next tree walk could no longer find them.

In this archived launcher setup, stopping ros2 launch left child nodes alive. They continued holding the Hailo-8, so another tool could fail much later with no obvious connection to the stop that had supposedly completed.

an hour later, in another tool (summarised)
HAILO_OUT_OF_PHYSICAL_DEVICES

Two fixes, both measured, both wrong

The first attempt reset an inherited SIGINT-ignore disposition and signalled the launcher directly. It did not exit within 20 seconds. The escalation sent SIGTERM, but in this execution path that did not terminate the descendants. This is an observation about that launcher and wrapper, not a guarantee about signal forwarding in every ROS 2 version.

The second tried setsid and a process-group signal. os.setsid() failed in that context; the wrapper exited before the intended graph started. Its stored PID was not evidence of a live replacement process. The stop function returned without a useful success or failure report.

Both attempts depended on another process passing the signal on. The revised kill_tree walked the launcher’s descendants and signalled the captured processes directly: INT, then TERM, then KILL. That removed the relay assumption for the observed tree, but introduced another question: when should that tree be captured?

Verified on hardware and correct are not the same claim.

The fourth defect

A controlled regression fixture found something the earlier hardware runs had not exercised. kill_tree walked the process tree again at every escalation step. Once the parent exited, that was no longer equivalent to retaining the original descendants.

Step one: the launcher has two child nodes and receives SIGINT. Step two: the launcher exits; its children are re-parented to init, so a fresh walk from the launcher finds nothing. A child that ignored SIGINT is never signalled again. The fix snapshots the whole tree before sending any signal.1 · SIGINT to the treeros2 launchnode A ✓node B: ignores2 · parent exits; re-walk from it finds nothing(gone)initnode B lives3 · fix: snapshot firstpids = walk(tree)for sig in INT, TERM, KILL: signal(pids, sig)orphans can’t hide from a list
After its parent exits, a surviving child is adopted by init or a subreaper. Walking from the old parent no longer discovers it. The diagram’s “init” is shorthand for that new reaper.

A child that ignored SIGINT could therefore outlive the launcher and disappear from the next walk. The earlier bench runs used nodes that exited on the first signal, so they never exercised this branch. The fixture deliberately spawned a child that ignored SIGINT and checked that later escalation still reached it.

The correction captured the descendants before asking any of them to exit, then retained them through escalation. That is the consumer-visible contract: “stop” must not report success while a known child still owns the resource.

The related Meghdhut terminal interface showing link traffic
A related link-tool interface from the Meghdhut archive, not a capture of this ROS process regression. A leftover process can keep a device busy even when the next user-facing tool looks unrelated.Open image to inspect at full size.

Signals are requests, not acknowledgements

Sending a signal successfully tells me that the kernel accepted the request for the addressed process. It does not establish that the process completed cleanup, released a device or even exited. A process can ignore a catchable signal or take time to handle it. SIGKILL cannot be handled, but it also bypasses application cleanup.

The observation after each stage therefore matters: which captured processes still exist, which have exited, and whether the stop reached its stated outcome. A failed wrapper and a graph that shut down cleanly should not collapse into the same reassuring status.

Escalation is also not the vehicle’s physical emergency stop. Terminating host processes cannot substitute for an independently enforced actuator-safe state. This investigation concerned software and device ownership, not a water-tested safety claim.

Where a PID snapshot stops being enough

A snapshot fixes this reparenting failure; it is not a universal process-lifetime boundary. Children created after the snapshot, process identity reused later, permissions and detached descendants need separate treatment. A stronger supervisor can use an owned service or cgroup and verify process identity rather than treating an old numeric PID as permanent ownership.

I would not copy this story into a command that kills every ROS-looking process on a laptop. The target is the graph this launcher owns. The regression is useful precisely because it creates that small, controlled tree and exercises the failure without depending on physical hardware.

The lasting change in my method is to keep both kinds of evidence: a run against the real environment, and a deliberately awkward process fixture that gives the fallback a reason to execute. For the same distinction at the hardware-protocol boundary, read from worked once to works every time.