yeti labs

field note 012 · 2026-09-07 · infra, sre

our slack agent never crashed, and that's why it was down for 22 hours

after our homelab box was moved and rebooted, our slack agent came up 25 seconds before the box could resolve names. it gave up, which was the plan. then it didn't exit, so the supervisor that was supposed to restart it never noticed, and for 22 hours the service read active while it listened to nothing.

deaf for
22h
unit state
active
restarts
0
ahead of dns
25s

the setup

we run an agent on the homelab that answers when you mention it in slack. at startup it probes every workspace it has a session for, picks a transport for each one (a websocket, or polling search where that's blocked), and then listens. it runs under systemd, the linux service manager, with Restart=always and a 10 second delay. that's the whole safety net: if the process dies, it comes back.

on 09-06 at 19:05 the box came back up. the agent started 25 seconds ahead of working dns (domain name system, the lookup that turns slack.com into an address), so all five workspace probes failed with "temporary failure in name resolution." the code ran one sweep and had a plan for zero results: log "no usable slack sessions," send a phone alert, and return from main(). a process that returns exits, and under Restart=always it would have kept coming back every 10 seconds until dns did. that never happened.

active the whole time, listening the whole time to nothing

what each signal read from the 09-06 19:05 boot until the fix, in hours

boot+6h+12h+18h+22hunit stateactive · 22hlistening on0 of 5 workspaces · 22hrestarts0alerts delivered0it started 25s ahead of dns, gave up,and then waited on a thread nobodywas ever going to stop.
source: the service's boot journal and our incident notes, 2026-09-06 to 09-07yeti labs · field note 012

why it never restarted

the process never exited. at startup the agent opens its local sqlite job queue through aiosqlite, which runs each connection on its own thread, and that thread isn't a daemon thread. python won't let an interpreter finish while a non-daemon thread is still alive. the normal shutdown path closed the database in a finally, but the give-up path returned before that block, so it skipped close_db(). main() returned and the interpreter sat there waiting.

from systemd's side that's a healthy process. no exit code, no crash, nothing to restart. systemctl is-active said active and NRestarts stayed at 0 the whole time. we found out on 09-07, when somebody mentioned the agent in a thread and got nothing back. any asyncio service that opens aiosqlite and returns early will hang the same way.

the alert died too

the "not listening" alert was the one thing that should have surfaced this right away. it's also an outbound call, so it failed on the same unresolved name, logged a warning, and the code moved on.

once that was fixed, the next restart's alert got a 400 back from the bot api. it quoted a slack error code, invalid_auth, and the underscore opened a markdown italic that never closed. operational alerts go out as plain text now.

the fix

two independent faults stacked, and fixing either one alone would have been enough. we shipped both the same day, plus the alert.

faultfix
unit ordered on network.target, which says nothing about the resolverafter network-online.target + nss-lookup.target
gave up after one sweep, and the early return skipped close_db()close in finally; retry, doubling 10s up to a 300s cap
alert lost to the same dns failureretry until it lands, then an all-clear
alert 400'd on an underscoreplain text

it's the same family as the login outage where every fix certified itself green: the check we trusted was reading something that agreed with it by construction.

what we'd do instead

  1. check the service's own words. ours logs "listening on N workspace(s)" once it's really connected, and that line in the current boot's journal is the health check now. the unit state only tells you a process exists.
  2. a startup that can fail on something transient should retry with a cap, and any path that does give up should leave through the same cleanup as everything else, so the supervisor actually sees the exit.
  3. order anything that calls out at boot on network-online.target and nss-lookup.target. plain network.target is satisfied before the box can resolve a name.
  4. an alert that shares the failure's dependency can't report the failure. have it say whether it landed, and keep sending until it does.
got a service that's green and quiet?

we'll check what it's actually doing.

talk to the agent →