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
DeleteActor often returns "Aborted: another operation is in progress" at high density #3945
In a closed-loop microVM benchmark on one large bare-metal node, most DeleteActor calls at high worker density fail with Aborted: another operation is in progress and only succeed after client retries. At lower density it's rare.
Why it matters
Retries hide it, but each failed attempt is a wasted RPC, and the actor keeps its slot while delete is retried. Without client retries, actors leak.
Ask
Find which concurrent operation collides with delete at high density, and have DeleteActor wait or serialize server-side instead of returning Aborted.
Related: #606 (ResumeActor returns the same Aborted error).
I traced where the Aborted comes from, in case it shortens the search.
ActorWorkflow.DeleteActor takes the actor's distributed lease before its first step and holds it until the workflow returns (cmd/ateapi/internal/controlapi/workflow_delete.go). acquireLease maps store.ErrLeaseConflict to Aborted "another operation is in progress for this actor" (workflow.go). The lease is one row per actor key in Postgres with a default TTL of 30 seconds, and AcquireLease is non-blocking: it returns ErrLeaseConflict immediately, as the store contract documents (store.go, atepg/lease.go). Nothing waits, so the failure is a pure race, and the window grows with density because every step of the competing workflow gets slower.
Operations that share the key, from the code: suspend and resume (workflow_suspend.go, workflow_resume.go), the worker's crash report (workflow_worker_crash.go), UpdateActor, tag operations, revert, the control plane's reconcile when it releases assignments, and atelet's snapshot-state reports (snapshot_report.go, ApplyReportedSnapshotState takes the lease on every upload and detach report). The holder to check first is suspend: it keeps the lease across the atelet Checkpoint RPC, and in synchronous mode atelet uploads the snapshot before returning. A delete landing in that window fails with no wait. The resumepaused benchmark already records this shape, where a delete racing an in-flight cycle loses the lease.
A second path is worth ruling out: the delete's own retry. A client timeout cancels the first attempt, but the server releases the lease only when the canceled workflow unwinds, and some callers retry right away (the sweperf retire path retries once immediately). At high density more first attempts reach the client deadline, so more retries collide with their own predecessor. A lease row that records the operation name, reported in the error and in a counter, would separate the two paths and name the colliding pair.
If the diagnosis holds, the fix the issue asks for is small in shape. Let DeleteActor wait for the lease with a bounded deadline instead of failing on the first conflict. Re-entry is safe because delete is idempotent, so after the wait it re-reads the actor and continues. Either a wait variant of AcquireLease or a short retry loop with jitter inside the workflow works, and the store contract needs one line to permit the wait. An in-process mutex is not enough, since the holder can be another ateapi replica.
AI use: I used AI tooling to draft this from reading the sources above, and I verified every reference myself.
Thanks yjjnls. I have an idea and want a maintainer's view first. Luiz Oliveira (@laoj2) , could you take a look?
This issue looks like one case of a wider gap. When a lifecycle operation can't finish in the call, nothing finishes it later. #1502 is another open case. #2910 was a similar case for resume(fixed).
The idea is on a lease conflict, DeleteActor sets delete_time without taking the lease. The lease holder finishes the delete when it ends. A background reconciler finishes deletes whose holder crashed. worker_assignment_reconciler.go already works this way for worker restarts.
To keep the API contract, DeleteActor still returns an error on conflict. The proto says it returns after the actor is removed, and old clients rely on that. The difference is that the delete now always finishes, even without a client retry.
This is a big change for this alone. It may only make sense as part of a general fix for operations that need to finish in the background.
Is this direction worth discussing, maybe as a design issue? I can also start by measuring which operations collide here.
Thanks both. I'd start small: record which operation holds the lease, in the error and a counter, so we know if it's suspend or the delete's own retry. If that confirms it, a bounded wait in DeleteActor fixes this without an API change. Finishing deletes in the background is a bigger change, so please open a separate design issue for it. Luiz Oliveira (@laoj2) does that sound right?
Thanks both. I'd start small: record which operation holds the lease, in the error and a counter, so we know if it's suspend or the delete's own retry. If that confirms it, a bounded wait in DeleteActor fixes this without an API change. Finishing deletes in the background is a bigger change, so please open a separate design issue for it. Luiz Oliveira (@laoj2) does that sound right?
+1 to this, we may be able to address this problem in a simpler way if we can pinpoint the operation that's holding the lease more often.
I'm just afraid that a background reconciler will make cross-workflow coupling brittle and will be a much bigger change. An example:
Setting delete_time will increment actors.version.
Meanwhile, the lease holder writes with PreconditionFrom(actor) against the version it read earlier, so concurrent ops (especially ones that hold a read across slow I/O like CreateTag can fail with a version conflict and need to be retried.
Activity
yjjnls commentedon Nov 19, 2026
I traced where the Aborted comes from, in case it shortens the search.
ActorWorkflow.DeleteActor takes the actor's distributed lease before its first step and holds it until the workflow returns (cmd/ateapi/internal/controlapi/workflow_delete.go). acquireLease maps store.ErrLeaseConflict to Aborted "another operation is in progress for this actor" (workflow.go). The lease is one row per actor key in Postgres with a default TTL of 30 seconds, and AcquireLease is non-blocking: it returns ErrLeaseConflict immediately, as the store contract documents (store.go, atepg/lease.go). Nothing waits, so the failure is a pure race, and the window grows with density because every step of the competing workflow gets slower.
Operations that share the key, from the code: suspend and resume (workflow_suspend.go, workflow_resume.go), the worker's crash report (workflow_worker_crash.go), UpdateActor, tag operations, revert, the control plane's reconcile when it releases assignments, and atelet's snapshot-state reports (snapshot_report.go, ApplyReportedSnapshotState takes the lease on every upload and detach report). The holder to check first is suspend: it keeps the lease across the atelet Checkpoint RPC, and in synchronous mode atelet uploads the snapshot before returning. A delete landing in that window fails with no wait. The resumepaused benchmark already records this shape, where a delete racing an in-flight cycle loses the lease.
A second path is worth ruling out: the delete's own retry. A client timeout cancels the first attempt, but the server releases the lease only when the canceled workflow unwinds, and some callers retry right away (the sweperf retire path retries once immediately). At high density more first attempts reach the client deadline, so more retries collide with their own predecessor. A lease row that records the operation name, reported in the error and in a counter, would separate the two paths and name the colliding pair.
If the diagnosis holds, the fix the issue asks for is small in shape. Let DeleteActor wait for the lease with a bounded deadline instead of failing on the first conflict. Re-entry is safe because delete is idempotent, so after the wait it re-reads the actor and continues. Either a wait variant of AcquireLease or a short retry loop with jitter inside the workflow works, and the store contract needs one line to permit the wait. An in-process mutex is not enough, since the holder can be another ateapi replica.
AI use: I used AI tooling to draft this from reading the sources above, and I verified every reference myself.
Nagato-Yuzuru commentedon Nov 22, 2026
Thanks yjjnls. I have an idea and want a maintainer's view first. Luiz Oliveira (@laoj2) , could you take a look?
This issue looks like one case of a wider gap. When a lifecycle operation can't finish in the call, nothing finishes it later. #1502 is another open case. #2910 was a similar case for resume(fixed).
The idea is on a lease conflict, DeleteActor sets delete_time without taking the lease. The lease holder finishes the delete when it ends. A background reconciler finishes deletes whose holder crashed. worker_assignment_reconciler.go already works this way for worker restarts.
To keep the API contract, DeleteActor still returns an error on conflict. The proto says it returns after the actor is removed, and old clients rely on that. The difference is that the delete now always finishes, even without a client retry.
This is a big change for this alone. It may only make sense as part of a general fix for operations that need to finish in the background.
Is this direction worth discussing, maybe as a design issue? I can also start by measuring which operations collide here.
roycaihw commentedon Nov 24, 2026
Thanks both. I'd start small: record which operation holds the lease, in the error and a counter, so we know if it's suspend or the delete's own retry. If that confirms it, a bounded wait in DeleteActor fixes this without an API change. Finishing deletes in the background is a bigger change, so please open a separate design issue for it. Luiz Oliveira (@laoj2) does that sound right?
laoj2 commentedon Nov 26, 2026
+1 to this, we may be able to address this problem in a simpler way if we can pinpoint the operation that's holding the lease more often.
I'm just afraid that a background reconciler will make cross-workflow coupling brittle and will be a much bigger change. An example:
delete_timewill incrementactors.version.