Skip to content

provider: fix instance managers wedging on dropped watcher events#823

Open
benoit-nexthop wants to merge 1 commit into
cloudbase:mainfrom
nexthop-ai:dropped-events
Open

provider: fix instance managers wedging on dropped watcher events#823
benoit-nexthop wants to merge 1 commit into
cloudbase:mainfrom
nexthop-ai:dropped-events

Conversation

@benoit-nexthop

Copy link
Copy Markdown
Contributor

Instance managers acted solely on an in-memory copy of the instance, updated only via watcher events. consolidateState() held the manager mutex across provider calls and backoff sleeps (up to minutes), which starved handleUpdate() and caused Update() to drop events after its 10s send timeout. If the dropped event was the transition back to pending_delete after a failed provider delete, the manager was left with a stale "deleting" status - which consolidateState had no case for - and idled forever while the runner stayed in pending_delete for days.

  • consolidateState no longer holds the mutex for its duration; it works on a snapshot via new getInstance()/setInstance() accessors.
  • Reconcile against the database on every tick via the new helper GetInstance(), so a dropped event can no longer permanently wedge a manager. A missing row exits the manager cleanly.
  • Handle InstanceDeleting as an interrupted delete and retry it with the normal backoff.

Instance managers acted solely on an in-memory copy of the instance,
updated only via watcher events. consolidateState() held the manager
mutex across provider calls and backoff sleeps (up to minutes), which
starved handleUpdate() and caused Update() to drop events after its 10s
send timeout. If the dropped event was the transition back to
pending_delete after a failed provider delete, the manager was left with
a stale "deleting" status - which consolidateState had no case for - and
idled forever while the runner stayed in pending_delete for days.

- consolidateState no longer holds the mutex for its duration; it works
  on a snapshot via new getInstance()/setInstance() accessors.
- Reconcile against the database on every tick via the new
  helper GetInstance(), so a dropped event can no longer permanently
  wedge a manager. A missing row exits the manager cleanly.
- Handle InstanceDeleting as an interrupted delete and retry it with the
  normal backoff.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant