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
Two deployments placed at the same time can reserve more than a node's capacity #315
Placement reads the load of the nodes and then stores the new allocations, in one transaction per deployment but without a lock (DeploymentPipeline.place, apps/api/src/modules/deployments/application/deployment-pipeline.ts). Two deployments of different applications that are placed at the same moment each read the load without the other's replicas, and both can land on the same node. Together they can reserve more than the node's capacity.
One application cannot race with itself: it has at most one active deployment.
Found while working on #301. The behaviour is older, but it matters more now that every replica reserves CPU and memory (1 CPU and 512 MiB by default).
Expected
Two placements in the same organization never read the same load. Options to compare:
a transaction-level advisory lock per organization around the read and the insert in place;
a constraint or a check at insert time that the node still has room.
Done when
An integration test with PostgreSQL places two applications concurrently on a node that has room for one, and exactly one of the two deployments fails with the cpu or memory reason.
SPEC section 6 says how concurrent placements are serialized.
Activity
fix(api): judge node liveness once the placement lock is held
test(api): prove that concurrent placements wait for the lock