Skip to content

atelet: stage default sandbox runtime into worker directory and remove runtimePrewarmer - #3852

Draft
Shrutiya Mohan (shrutiyam-glitch) wants to merge 2 commits into
agent-substrate:mainfrom
shrutiyam-glitch:syncpod-pins-default-runtime
Draft

Shrutiya Mohan (shrutiyam-glitch) wants to merge 2 commits into
agent-substrate:mainfrom
shrutiyam-glitch:syncpod-pins-default-runtime

Conversation

@shrutiyam-glitch

Copy link
Copy Markdown
Collaborator

Fixes #3279

gvisorCPUFeatures skipped staging when cpuFeatures already held the runsc digest. Promoting an evicted restorable gVisor version to defaultVersion while object storage was unreachable wrote an uncached runtime to sandbox-runtimes.json and unlinked the previous default.

buildFile also staged microVM defaults into a scratch directory and removed those links before runtimePrewarmer linked workers/<uid>/default-runtime/<hash> on a second queue. Cache GC could evict the default in that window once an entry passed --sandbox-asset-cache-min-age, and every re-sync repeated the scratch links.

stageDefault now stages the default version into workers/<uid>/default-runtime/<hash> via ensureSandboxAssets during buildFile. A populated directory stats each asset once, and an evicted asset is fetched and linked before write updates sandbox-runtimes.json and pruneDefaultRuntimeDirs removes retired defaults. stageScratch verifies restorable versions once per bundle hash in verifiedBundles for both gVisor and microVM, and runs the runsc CPU-feature probe from a scratch link outside the worker directory.

runtimePrewarmer and stageSandboxAssets have no remaining callers and are removed.

AI-assisted, I reviewed and tested it.

  • Tests pass
  • Docs updated

buildFile staged the default into a scratch directory it removed again and
left the link into workers/<uid>/default-runtime/<hash> to the runtime
prewarmer on another queue, so an eviction pass could take the default in
between once it was older than the cache's min age. A gVisor default whose
runsc digest was memoized was not staged at all, so promoting an evicted
version wrote a file naming a runtime the cache did not hold.

Stage the default straight into its default-runtime directory with the
same ensureSandboxAssets call an activation uses: a filled directory costs
a stat per asset, and an evicted asset is fetched before the file names the
version. After the write, remove the directories of defaults the file no
longer names. Verify restorable versions once per bundle hash for both
classes, keeping the runsc probe memoized per digest.

Signed-off-by: Shrutiya <shrutiyam@google.com>
The syncer links each worker's default runtime into its directory as it
builds the worker's file, so the prewarmer had nothing left to do. Drop it
with its queue, the dirGone checks it needed because the syncer could
remove its directory under it, and the stageSandboxAssets variant that
existed so it would not recreate that directory.

Signed-off-by: Shrutiya <shrutiyam@google.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

1 participant