Skip to content

Idle detection never fires on instances whose NIC isn't eth0/ens* (e.g. enp39s0 on m8a/AL2023): network check always returns the 'assume active' 1,000,000 bytes #919

Closed

Description

@scttfrdmn

Version: spawn/spored 0.128.2 (38b2d66). Instance: m8a.4xlarge, Amazon Linux 2023.12.20261013, us-west-2.

Symptom: spawn launch demo --instance-type m8a.4xlarge --spot --ttl 1h --idle-timeout 15m -y, then leave it untouched. After 33 minutes (load 0.00, no users) it is still running. spored.log on every tick:

2026/10/15 17:32:29 monitor tick 32
2026/10/15 17:32:29 Not idle: Network traffic 1000000 bytes
2026/10/15 17:33:29 monitor tick 33
2026/10/15 17:33:29 Not idle: Network traffic 1000000 bytes

The value is exactly 1,000,000 every minute. spawn status shows the same thing as Network: 976.6 KB/min. Real traffic was a few KB/min:

$ ip -o link show | awk '{print $2}'
lo:
enp39s0:
$ # /proc/net/dev, 10 s apart (rx, tx) — during an SSH session
enp39s0: 217684698 2925026
enp39s0: 217699919 2963423

Cause (pkg/agent/sys_linux.go, sysReadNetworkBytes):

if strings.Contains(line, "eth0") || strings.Contains(line, "ens") {

enp39s0 matches neither, so the function returns rx = tx = 0 (not -1). Then in pkg/agent/agent.go getNetworkBytes():

if prevRx == 0 && prevTx == 0 {
    return 1000000 // First call — no delta; assume active
}

is true on every call, because prev stays 0. So the network check always says active, and idle-stop can never trigger. Instances like this run until TTL, and with no --ttl they run until the reaper (if any).

Suggested fix:

  1. Sum all interfaces except lo (and virtual ones like docker*, veth*, br-*), or enumerate /sys/class/net/* and skip those with no device link, rather than matching name prefixes. Predictable names vary by instance family and AMI: eth*, ens*, enp*s*, enX*.
  2. Track "first sample" with a bool instead of prev == 0, and return -1 (unknown) when no interface matched. Then "no matching interface" is logged once as a warning instead of looking like permanent activity.
  3. Add a test with an enp39s0-only /proc/net/dev fixture.

Impact: high. Idle detection is one of spored's three core lifecycle guarantees (and is on the talk slide "Instances that clean up after themselves"). Here it silently does nothing, and status reports "Idle timeout: 15m (currently active)" as if it were working.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions