You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
spored reload never reaches the running daemon: it reloads a throwaway agent in its own process #1278
Found while triaging #1262. Verified in code on main (e45e1b9).
spored reload never reaches the running daemon.handleReload (cmd/spored/main.go:1360) builds a new provider and a throwaway agent, agent.NewAgentForQuery, in its own short-lived process. It calls Reload on that throwaway, prints its config and exits. There is no IPC, and no signal reaches the daemon: spored handles only SIGINT and SIGTERM (cmd/spored/shutdown_other.go:17), with no SIGHUP handler. The daemon's config changes only through its own periodic refresh, refreshConfigFromTags, which runs on the first tick and every 5th after (pkg/agent/agent.go:656; the tick is 1 minute by default). So after a tag change the daemon can run on stale config for up to about 5 minutes, whether or not anyone ran reload.
Who relies on it:spawn extend runs sudo /usr/local/bin/spored reload over SSH or SSM after changing spawn:ttl (cmd/extend.go:455) and reports success. Its failure paths tell users to run it by hand (cmd/extend.go:161, :319). The output, "✓ Configuration reloaded successfully", describes the throwaway's config, not the daemon's.
Effect: usually small, because the daemon catches up within about 5 minutes. But the command claims something it does not do, and anything that has to take effect sooner gets nothing: an extend close to the deadline, or a newly set or changed spawn:cost-limit. #1262 is about a cost limit not firing after spawn extend plus a reload. Its "reload resets the cost clock" theory does not hold, since the reload never reaches the daemon and the compute base is persisted in a tag (agent.go:1033). That is a separate question, but this is why the reload cannot be the cause.
Options:
A SIGHUP handler in the daemon that calls refreshConfigFromTags; spored reload signals the running daemon through its pid or systemctl kill -s HUP spored, and reports what the daemon now has.
Have reload say what it actually does, and have extend stop calling it.
A gate for option 1: start an agent, change a fake provider's tags, send the reload, and assert the running agent's config changed without waiting for a tick.
Activity
fix(spored): reload reaches the running daemon (#1278)