Skip to content

spored repeats a failed idle stop every minute: pre-stop hook, DNS teardown and an 'idle_stopped' notification each time #948

Closed

Description

@scttfrdmn

Found while fixing #922. Verified by reading pkg/agent/agent.go; not reproduced live.

When the idle timeout is reached, checkAndAct (agent.go, the "4. Check idle" block) calls a.stop() / a.hibernate() and returns. stop() runs the pre-stop hook, runs Cleanup (DNS deregistration, compute flush), warns users, sleeps 5s, and then calls provider.Stop. If that call fails, it only logs Failed to stop instance.

Nothing records that the stop failed. On the next tick the instance is still idle and past the timeout, so it all runs again: once a minute, until TTL.

Each repeat does three things:

  • sends another idle_stopped notification, although nothing stopped;
  • runs the pre-stop hook again, which may not be idempotent (e.g. an aws s3 sync);
  • deregisters DNS again, so a running instance loses its name.

How to trigger it

Suggested fix

  • After a failed stop or hibernate, back off, or stop retrying the idle action, and say so once in the log and the notification.
  • Send idle_stopped only after StopInstances succeeds.
  • For a one-time Spot instance (spawn:spot-request-type absent or one-time, and IMDS lifecycle spot), don't attempt the stop at all.

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