Skip to content
2026-09-15 Sensor freeze on 4 plants

2026-09-15 Sensor freeze on 4 plants

DateSeptember 15, 2026
AuthorsNéstor Salceda
StatusRecovery in progress
SummaryFollowing the AF_XDP capture backend rollout, sensors at 4 plants (Algontec SK, Algontec PL, Algontec ES, Cefa Zagan) became unreachable in sequence, starting with Algontec SK. Root cause, per cluster-side review: agentmanager became unstable while streaming isolation forest models to the fleet at once, leaving the affected sensors unable to sync with the backend and in a bad, unresponsive state.
Impact4 sensors unreachable, one per plant (Algontec SK, Algontec PL, Algontec ES, Cefa Zagan). <TBD: duration of outage per site, whether traffic capture/discovery was lost during the window, whether this required a site visit to power-cycle>
Root Causesagentmanager (the cloud-side gRPC service) became unstable while sending every isolation forest model for an account to the sensor fleet in one shot: GetModels loaded an account’s entire model set into memory before streaming anything, and the agentmanager deployment has no memory requests/limits at all, making it the first thing evicted under any node memory pressure. This left the affected sensors unable to complete their model/command sync with the backend and in a bad, unresponsive state. Determined from cluster-side review (agentmanager logs/pod restarts), not independently verified from within this session. Separately, xsk.Poll(xdpPollTimeout) in the AF_XDP capture loop was found to use a fixed 200ms timeout instead of blocking (-1), a real bug, fixed in PR #2996, but not established as the cause of this specific incident.
TriggerRollout/enable of the AF_XDP capture backend to the fleet, which triggered the affected sensors to reconnect and pull a full model sync from agentmanager at the same time.
Resolution<TBD: what was actually done to bring the 4 sensors back — revert to previous backend, remote fix, manual reboot at each site?>
DetectionManual: checking sensor health by hand (no automated alerting caught this).

Action Items

Action ItemTypeOwnerBug
Stop GetModels from unmarshaling stored models then re-marshaling them, send the stored JSONB straight throughFixNéstor Salceda Alonsosafetybits#2999
Paginate GetModels/FindModels (keyset pagination on resource_id, rule_id) instead of loading an account’s entire model set into memory before streamingFixNéstor Salceda Alonsosafetybits#3001
Add memory requests/limits to the agentmanager k8s deployment so it stops being the first thing evicted under node memory pressureFix<TBD><TBD>
Change xsk.Poll(xdpPollTimeout) to block (-1) until a packet arrives instead of a finite timeout (separate bug found during investigation, not established as this incident’s cause)FixNéstor Salceda Alonsosafetybits#2996
Arm the hardware watchdog (iTCO_wdt, present on both N150 and N305) via systemd (RuntimeWatchdogSec=/ShutdownWatchdogSec=), explicitly configured rather than relying on platform defaults, so systemd force-reboots the box if userspace stops respondingMitigationNéstor Salceda Alonsosafetybits#3000
Enable kernel autopanic-on-lockup sysctls (kernel.softlockup_panic=1, kernel.hung_task_panic=1, panic=N) so a stuck/overloaded kernel reboots itself instead of sitting unresponsiveMitigationNéstor Salceda Alonso
Add a Docker HEALTHCHECK (plus something acting on “unhealthy”, e.g. an autoheal-style sidecar) for the converged Flatcar/Docker sensor image, tied to real capture-goroutine progress rather than plain process liveness. Design deferred, to be discussed separately.Mitigation<TBD><TBD>
Reduce reliance on plant staff power-cycling the appliance (superseded by the three watchdog/autopanic/healthcheck items above, keep as tracking item until those land)Follow-up<TBD><TBD>
Adopt a canary rollout strategy for risky agent/capture-path changes: land on physically-reachable plants first (e.g. Malpica) before the wider fleet, so a bad rollout can be fixed by driving there instead of depending on remote on-site staffFollow-up<TBD><TBD>

Lessons Learned

What went well

  • Production wasn’t affected

What went wrong

  • agentmanager had no memory requests/limits at all, making it the first thing evicted under node memory pressure, and GetModels loaded an account’s entire model set into memory before streaming any of it, a load that had been growing (per-device isolation forest models, more rules on isolation forests, a longer training window).
    • The AF_XDP rollout triggered the affected sensors to reconnect and pull a full model sync at the same time, which is understood to have tipped this over.
  • Separately, and not established as the cause of this incident, the AF_XDP capture loop polled on a fixed 200ms timeout instead of blocking until a packet arrives, so idle queues still woke on a timer and burned CPU regardless of traffic. This wasn’t caught before fleet rollout either, and was fixed along the way.
  • Detection was manual (checking sensor health by hand at 20:00 and 23:00), no automated alerting flagged the sensors going unreachable.
  • Recovery currently depends on physical intervention (someone at the plant pressing the button) because the sensor has no watchdog/self-healing.
  • The rollout went straight to Algontec SK, PL, ES, and Cefa Zagan, all sites far enough away that recovery meant coordinating with remote plant staff rather than someone driving over. No canary group of physically-reachable plants was used first.

Where we got lucky

  • Production wasn’t affected

Timeline

September 14, 2026 (all times CEST)

  • AF_XDP backend was cut and run in staging to validate it worked before the fleet rollout.

September 15, 2026 (all times CEST)

  • 17:00 AF_XDP backend rollout started.
  • 20:00 Check-in: Algontec SK unreachable. (exact time it went down between 17:00 and 20:00 is unknown) Investigation started.
  • 23:00 Check-in: Algontec PL, Algontec ES, and Cefa Zagan also unreachable, SK still unreachable. (exact time each went down between 20:00 and 23:00 is unknown)

September 16, 2026 (all times CEST)

  • 09:30 A separate bug identified during investigation: xsk.Poll finite timeout causing a busy loop instead of blocking until a packet arrives. Fixed (PR #2996), later confirmed not to be the cause of this incident.
  • <TBD: time> Root cause identified: agentmanager becoming unstable while streaming an account’s full model set to the fleet at once, triggered by the AF_XDP rollout causing affected sensors to reconnect and request a full model sync simultaneously. Determined from cluster-side review.
  • <TBD: time> Recovery actions taken.

Supporting Information

Root cause: agentmanager instability while streaming models to the fleet

Per cluster-side review (not independently verified from within this session): agentmanager’s GetModels RPC loaded an account’s entire isolation forest model set into memory before streaming any of it to a sensor, and the agentmanager k8s deployment (deployments/k8s/agentmanager.yaml) has no memory requests/limits at all, so it runs as BestEffort QoS and is the first thing the kubelet evicts under any node memory pressure. That model load had been growing: per-device isolation forest models instead of one coarser model, more rules ported onto isolation forests, and a training window that’s grown in steps (7d -> 14d -> currently 30d). The AF_XDP rollout is understood to have triggered the affected sensors to reconnect to agentmanager and request a full model sync at the same time, and that load is what pushed agentmanager into instability, leaving those sensors unable to complete their sync and in a bad, unresponsive state.

Fixed in two steps:

  • PR #2999: GetModels was unmarshaling the stored model JSON into a Go struct just to json.Marshal it straight back to bytes for the response, sending the stored JSONB straight through instead removes that round trip and the transient allocation.
  • PR #3001: GetModels/FindModels switched to keyset pagination (resource_id, rule_id, backed by the existing unique constraint’s index), streaming a bounded page at a time instead of loading the whole account into memory up front.

Still open: agentmanager has no memory requests/limits configured, which is the other half of why it was the thing that broke under this load rather than degrading gracefully.

A separate bug found during investigation: AF_XDP poll timeout

While investigating this incident, agent/internal/network/xdp_capturer.go:83 (n, err := xsk.Poll(xdpPollTimeout)) was found to use a fixed 200 * time.Millisecond timeout (xdp_capturer.go:14) instead of blocking (-1) until a packet arrives. This is a real bug, fixed in PR #2996, but subsequent investigation did not establish it as the cause of this incident.

This is not a kernel bug. Blocking poll()/select()-style syscalls work as designed, sleeping the caller with zero CPU cost until data is ready. The bug was a single application-level call: xsk.Poll(xdpPollTimeout) passes a fixed 200ms timeout instead of -1, so the capture goroutine wakes up and re-enters the poll path every 200ms whether or not a packet is waiting, instead of blocking until one arrives, the same way the existing afpacket backend already does (afpacket_capturer.go:46-86 blocks on ZeroCopyReadPacketData(), one goroutine, no timer). Fixing it removes that CPU tax regardless of traffic level, a worthwhile fix on its own, just not the explanation for this incident.

Queue count and IRQ affinity placement (they differ between the N150 and N305 appliance hardware) were also looked at as a possible contributing angle, but that turned out to be about how the kernel/go-afxdp auto-tunes queue-to-core placement, not part of this bug, and isn’t pursued further here.

No config surface today

agent/cmd/agent/config.go:16-17 only exposes CAPTURE_INTERFACE and CAPTURE_BACKEND (afpacket default, afxdp alt, selected in agent/cmd/agent/factory.go:113-116). The poll timeout is not configurable anywhere in safetybits today, it’s a hardcoded const.

Self-healing / reliability rationale

Current state: both unit files (build/debian/safetybits-agent/systemd/safetybits-agent.service and the Flatcar build/appliance/sensor/sensor.yaml) only have Restart=on-failure/Restart=always, which restarts on process exit. That would not have helped on the 15th either way, whatever kept the affected sensors stuck, they didn’t crash and exit, they stayed up and unresponsive. No sd_notify/systemd-watchdog integration, no panic recovery, no health-check goroutine exist anywhere in agent/.

Confirmed present but unused: the hardware watchdog. wdctl on both N150 and N305 appliances shows /dev/watchdog0, iTCO_wdt, 30s timeout, already counting down (Timeleft: 29s, KEEPALIVEPING active). Nothing in this repo configures RuntimeWatchdogSec or touches /dev/watchdog, so that petting is Flatcar/Container Linux’s own default, not something Safetybits set up deliberately. The affected plants currently run the Debian package, not Flatcar, so they have the same silicon but no petting at all today.

Why these three, in this order:

  • Hardware watchdog via systemd (RuntimeWatchdogSec=), made explicit rather than inherited: failure-mode-agnostic, if nothing pets it for 30s the box reboots regardless of whether the cause is a true kernel lockup, severe overload, a stuck retry loop against a misbehaving backend, or a deadlock. The petting itself is just systemd’s own userspace loop writing to /dev/watchdog on a timer, it doesn’t need to detect why things are bad, only that the pet didn’t happen in time, which is a much lower bar than kernel lockup detection. Works identically whether the agent runs natively or in a container, so it survives the Debian-to-Flatcar convergence unchanged. Note the AF_XDP backend had already been cut and validated in staging on September 14, staging didn’t surface the separate poll-timeout bug either, which is itself an argument for a safety net that doesn’t depend on catching every case pre-rollout.
  • Kernel autopanic on lockup (kernel.softlockup_panic=1, kernel.hung_task_panic=1, panic=N): a complementary, also deployment-agnostic layer, worth having for genuine lockups (gives a clean panic trace before reset). Whether the affected sensors were in a true kernel softlockup on the 15th, versus stuck in some other unresponsive state while unable to reach agentmanager, is unconfirmed (no kernel logs from that night), so this sysctl is a reasonable bet, not a proven fix for what actually happened. The hardware watchdog above is the layer that catches it either way, regardless of mechanism.
  • Docker HEALTHCHECK (design deferred): considered against a systemd process-level watchdog (Type=notify + sd_notify), which fits the current Debian native-process path cleanly but is awkward to bridge across the container boundary once converged to Flatcar/Docker (would need NOTIFY_SOCKET forwarded into the container). Since convergence to Flatcar/Docker is coming soon, HEALTHCHECK is the mechanism more likely to survive past that point. Whatever the healthcheck ends up probing, it needs to reflect real progress (capture, command sync with the backend), not just “the process is scheduled”, otherwise it inherits the same blind spot as this incident: a sensor stuck unable to reach the backend could still keep a naive liveness ping alive.