Skip to content

server,controller: bound task reconciliation deadline under the task lock TTL #473

Not planned

Description

@aprajitaarora13

Problem

Follow-up from #463 (review) and #468.

In internal/substrate/client.go, retryOnCodes retries codes.Unavailable and codes.Aborted for up to defaultRetryAttempts = 10 (defaultRetryInterval = 200ms, maxRetryInterval = 2s with jitter), meaning a single Substrate RPC can take up to ~6s–20s before exhausting retries.

Meanwhile, in internal/lock/lock.go, NewRedisLocker acquires the per-task lock with a fixed 30s TTL (ttl = 30 * time.Second) and no renewal. Because Reconcile performs multiple sequential Substrate RPCs (EnsureAtespace, EnsureActorTemplateWithImage, EnsureActor, SuspendActor/ResumeActor, plus defaultWorkspaceReadyTimeout = 15s), if Substrate flaps mid-request across more than one step, a single reconciliation can outlast the 30s task lock TTL while still mutating Substrate and task status in the store.

Proposed Solution

Enforce a per-request / reconciliation context deadline bounded under the task lock TTL (e.g. deriving a context.WithTimeout after acquiring the task lock in CreateTask, ResumeTask, SuspendTask, and DeleteTask, or bounding the reconcile budget relative to the lock TTL) so that an in-flight reconcile cannot continue operating on a task after its lock has expired.

Activity

  1. added a commit that references this issue on Oct 15, 2026
    7598a36
  2. rakyll commented on Nov 25, 2026

    @rakyll
    Member

    Obsolete: the Redis lock and its TTL are gone.

    We are closing this as part of a cleanup after the significant changes in v0.4.0, because it is probably obsolete or out of scope now. If you think this is a mistake, please reopen it (or leave a comment if you can't reopen it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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