Skip to content

Feat: release stopped server capacity#8

Merged
aarani merged 2 commits into
mainfrom
feat/release-stopped-server-capacity
Jun 21, 2026
Merged

Feat: release stopped server capacity#8
aarani merged 2 commits into
mainfrom
feat/release-stopped-server-capacity

Conversation

@aarani

@aarani aarani commented Jun 21, 2026

Copy link
Copy Markdown
Member

No description provided.

…edule

A stopped server used to keep its full slot: the host runtime counted its
CPU/memory toward capacity, and the scheduler kept its reservation, so a
stopped server tied up resources it was not using and was pinned to its
original host.

Free that capacity and let a stopped server reschedule onto any host when it
next starts:

- Host runtime no longer counts non-running VMs (checkCapacity/fitsLocked);
  Start re-checks capacity since a resumed VM's slot may have been taken.
- New `evict` op across the agent contract (Runtime -> firecracker/fake ->
  link -> hub -> Commander -> RemoteProvisioner -> Provisioner). Firecracker's
  Deprovision and Evict share teardown(deleteWorld): Evict drops the
  host-local VM + disk but keeps the durable world snapshot; Deprovision also
  deletes it.
- reconciler.stop: snapshot world -> evict VM -> scheduler.Release -> mark
  stopped. MarkStopped now clears host_id, so UsedCapacity stops counting the
  server and its next start re-runs placement (world restored from the durable
  store, keyed by server id).

Tradeoff: on a host with world persistence but no durable store, the world is
host-local, so a reschedule to a different host starts from an empty world.
Documented inline; capacity is freed on stop regardless.
TestGameServerLifecycle asserted the running server's port was exactly 25565,
which only holds when it is the first VM on the shared suite host. The fake
runtime hands out the lowest free host port at or above the standard Minecraft
port, so when other tests' VMs hold the low ports this server gets the next one
up (e.g. 25570) and the assertion flakes depending on suite ordering. Assert it
is a valid pool port (>= 25565) instead.
@aarani aarani merged commit db48795 into main Jun 21, 2026
3 checks passed
@aarani aarani deleted the feat/release-stopped-server-capacity branch June 21, 2026 11:06
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.

2 participants