Inside switchd: Threads, Watchdogs, and a Closed SDK

Site Admin · 3 Dec 2026 · Network Hardware & NOS

switchd is a multithreaded wrapper around a closed ASIC SDK. A heartbeat proves liveness; it cannot restart a stuck thread. So the watchdog restarts the process, the ASIC is reinitialised, and every BGP session goes with it.

switchd is a multithreaded userspace daemon wrapped around a closed ASIC
SDK. A watchdog proves it is alive by expecting a heartbeat. When an SDK thread
stops responding, the watchdog cannot restart the thread — so it restarts the
process, and the switch loses its forwarding state.

The four layers

A Cumulus switch is a stack of four layers that must agree:

  1. NVUE turns declarative intent into FRR configuration and kernel state.
  2. FRR runs the routing protocols — bgpd holds the sessions and the RIB,
    zebra owns the kernel routing table, bfdd and others sit alongside.
  3. The kernel holds routes, neighbours, bridges, VRFs and interfaces.
  4. switchd translates that state into ASIC tables through the vendor SDK.

The direction that matters is downward. FRR can be healthy while switchd is
stuck, because FRR only knows what the kernel tells it. The kernel can be
healthy while the ASIC is stale, because the kernel does not know what
switchd programmed.

What switchd's threads do

switchd is not a single loop. It runs several threads with different jobs,
serialised around access to the SDK:

The exact thread layout is unpublished. The release note names "internal SDK
threads" — the layer that talks to the chip, not FRR and not NVUE.

Why a thread hang becomes a process restart

A watchdog has a crude contract: prove you are alive within the window, or I
will restart you. Three things make that contract dangerous in a daemon like
this:

The watchdog cannot see inside the process. It sees a heartbeat, not a
thread table. If the heartbeat is serviced by a thread that is itself waiting
on the SDK, a busy-but-healthy daemon and a genuinely hung one look identical.

It cannot restart one thread. Thread-level recovery requires the
application to own the policy — cancel the operation, reinitialise the SDK
handle, respawn the worker. A generic watchdog can only signal or restart the
process.

Restarting the process reinitialises the ASIC. The daemon reopens the SDK,
resets the chip, and reprograms every table from kernel state. Ports can
bounce. Forwarding is interrupted. And because BGP sessions run over interfaces
and the kernel's TCP stack, every session on the box drops.

The release note describes the outcome, not the policy: threads stop
responding, switchd restarts repeatedly, BGP flaps, ~23 minutes per event.

Where the 23 minutes comes from

A restart is not one timer. It is a sequence:

Stage What happens Rough cost
Detect and restart Heartbeat missed, process exits, systemd starts it seconds to a minute
SDK reopen Chip reinitialised, ports reprogrammed minutes
Interface recovery Links up, LACP/LLDP, neighbours relearned tens of seconds
BGP re-establish TCP, capabilities, OPEN/KEEPALIVE seconds per peer, parallel
Full-table exchange UPDATEs in both directions minutes on large tables
FIB programming Best paths installed into the ASIC minutes at scale
Peer reconvergence Spines and reflectors recompute and re-advertise minutes

NVIDIA's own forum guidance calls a switchd restart "an intensive operation"
that can take three minutes or more. Add BGP full-table exchange and FIB
programming across a fabric, and 23 minutes is not an exaggeration — it is an
average that hides a long tail.

What the operator can and cannot see

Visible: the restart in syslog, the restart counter, BGP sessions dropping
together and coming back, a spike in UPDATEs, a temporary drop in advertised
prefixes.

Not visible: the hang itself. There is no error before the watchdog fires,
no counter for "SDK thread stalled", and no supported way to inspect a closed
daemon's thread state. By the time you have evidence, the restart has already
happened — which is why part 10's first control is a restart counter.

Next: Part 6 — the smaller failures first: Cumulus bugs that share the same
shape, and the ladder that leads to #5376361.