Skip to content

fix: mend nine bugs in sessions on AWS Lambda microVMs - #670

Merged
kalaspuff merged 4 commits into
mainfrom
fctl/1770-carl-oscar-aaro-14-02
Dec 2, 2026
Merged

kalaspuff merged 4 commits into
mainfrom
fctl/1770-carl-oscar-aaro-14-02

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes nine bugs that came in with #665's AWS Lambda microVM support. Some left microVMs running, and billing, for hours, some made the host retry at once without end, and some hid errors from people:

  • MicroVMs left running. A microVM that was starting or resuming as its session's run ended, or whose suspend failed, ran until Lambda's 8-hour end. The upkeep now suspends one that has gone a minute like that, or lets it go if it can't. Before it lets one go, it checks again that the session's next run hasn't taken it back, or run a new one by its name, while it waited.
  • Warm pool loop. A warm microVM that failed to start for a reason the pool doesn't pause for, such as a request Lambda found wrong, was replaced at once, over and over. The pool now waits a minute after a failed start, or less if the settings change.
  • Image archive upload. A failed upload of the archive Lambda builds the image from was retried every 5 seconds and shown nowhere. It now shows as the runner's problem and on its image, and is tried again after 30 minutes, as a failed build is. The wait keeps saying why.
  • Forgotten microVMs. After a runner's image changed, the host forgot every microVM a list of the new image lacked, sessions' included, without terminating them. It now asks Lambda about each one the list lacks and forgets it only once Lambda says it is gone. It also forgets one only if a session's next run hasn't replaced it meanwhile.
  • Take out and Remove. Workspace admins couldn't take a microVM runner out of the workspace, or remove a member's that enrolled there. The microVM cards now offer Take out and Remove as runner rows do, with the same confirmation.
  • Image version errors. An image version the server refused showed no error. The error now shows under Version, and the web app also checks the version before saving, as it checks the other fields.
  • Checkpoints. A checkpoint that timed out stopped a session from ever suspending again. A finished upload no longer holds the next checkpoint off.
  • Agent downloads. fctl-agent downloads for two architectures shared one temp file, since with_extension cut the name at the version's last dot. Each download now has a temp file of its own, which it removes if it fails.
  • Chunk size. In microvm-serve, a chunk size near usize::MAX overflowed the body-length check and panicked the connection's task. It is now refused.

New tests cover the first four bugs, Take out and Remove, the version error and the chunk size. I checked that the tests for the first two, the forgotten microVMs, the cards and the version error fail without their fixes, as does the test where a session takes its microVM back while the upkeep suspends it. fctl-host's 334 tests, fctl-agent's microVM tests, the web app's tests, npm run check and cargo xtask check lint pass. docs/architecture.md describes the new behavior.

Screenshots

Before: a microVM runner added from elsewhere, and a member's that enrolled here, offered admins only Open (dark theme).

cards-before-dark-1180.png

After: Take out and Remove, as runner rows offer them, in the dark and light themes and at phone width.

cards-after-dark-1180.png

cards-after-light-1180.png

cards-after-dark-390.png

An image version with a space in it, after Save: before, nothing said what was wrong; after, the error shows under Version.

version-before-dark.png

version-after-dark.png

Worth confirming

  • Decision: a microVM that ended unsuspended and then fails to suspend is let go of at once rather than retried. Its session's agent saved its snapshot as it stopped, so the session's next run carries on in a new microVM, but it loses the suspended microVM's disk.
  • Decision: on the microVM cards, a runner's owner now gets Take out instead of its menu, as on runner rows, where the runner was added from another workspace. Before, the menu's Remove deleted the runner from every workspace.
  • Decision: when the image's archive fails to upload, or Lambda refuses to build the image, the 30-minute wait after now shows that failure's reason rather than "Lambda couldn't build the image".
  • Assumption: after a change of region, the new region's API answers 404 for the old region's microVMs, so the host still forgets them without terminating them, and Lambda ends them within 8 hours. Fixing that would need each microVM's region saved with it, and is left for later.

fctl session


Note

Medium risk. It changes how the host upkeep suspends, terminates and forgets AWS Lambda microVMs, which can destroy a session's suspended disk if a case is wrong, and it changes the checkpoint loop every session runs.

What it does. Fixes nine bugs in the AWS Lambda microVM support: the upkeep now suspends or lets go of microVMs whose run ended unsuspended, the warm pool waits a minute after a failed start, and a failed image archive upload is shown and retried after 30 minutes. It also asks Lambda before forgetting a microVM missing from a list, adds Take out and Remove to the microVM cards, shows image version errors, lets a finished upload stop holding off the next checkpoint, gives each agent download its own temp file, and refuses an oversized chunk in microvm-serve. Before the upkeep lets a microVM go, it now checks again that a session hasn't taken it back meanwhile.

Lost disk on failed suspend. A microVM that ended unsuspended and then fails to suspend is let go of at once instead of retried, so the session's next run starts in a new microVM without the suspended one's disk.

fctl review's first look at cc1156a · 10 files, +531 −55 · Review agent settings

Nine bugs came in with #665's AWS Lambda microVM support:

- A microVM that was starting or resuming as its session's run ended, or
  whose suspend failed, ran until Lambda's 8-hour end. The upkeep now
  suspends one that has gone a minute so, or lets it go if it can't.
- A warm microVM that failed to start for a reason the pool doesn't pause
  for was replaced at once, without end. The pool waits a minute after a
  failed start.
- A failed upload of the image's archive was retried every 5 seconds and
  shown nowhere. It is now the runner's problem and the image's error, and
  waits 30 minutes as a failed build does, still saying why.
- After the image changed, the host forgot the microVMs a list of the new
  image lacked, sessions' included, without terminating them. It now asks
  Lambda about each and forgets only those Lambda says are gone, and only
  if a session's next run hasn't replaced it meanwhile.
- Workspace admins couldn't take a microVM runner out, or remove a
  member's that enrolled here: the cards now offer Take out and Remove as
  runner rows do.
- An image version the server refused showed no error: it shows under
  Version, and the web app checks it before saving.
- A checkpoint that timed out stopped a session from suspending again: a
  finished upload no longer holds the next one off.
- fctl-agent downloads for two architectures shared one temp file.
- In microvm-serve, a chunk size near usize::MAX overflowed the body's
  length check and panicked the connection's task.

Tested with new tests in the host's driver, fctl-agent's HTTP reader and
the web app, which fail without the fixes.

fctl session: https://app.fctl.sh/s/ses_01M8VDPX5PJ1316JEN10GTNFRK
@fctl-sh
fctl-sh Bot requested a review from kalaspuff as a code owner December 2, 2026 13:18
@fctl-review

This comment has been minimized.

The upkeep checked a microVM's session had ended once, then awaited a
suspend of up to a minute, or other microVMs' terminates, before letting
it go by its name: a session's next run that took it back meanwhile, or
ran a new one by that name, lost its microVM. It checks again after each
await that the microVM is the same one, its run still ended and no
session's host works on it.

A download of fctl-agent that failed to write or rename its temporary
file, which is named for that download alone, now removes it.
@fctl-sh

fctl-sh Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

On the review's second finding, that failed downloads left their temporary files behind: fixed in 43a5520. When writing, setting permissions on or renaming the temporary file fails, the download now removes the file, so each failed try no longer leaves a binary-sized file in the bin directory.

@fctl-sh

fctl-sh Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

The failed cargo xtask check at 9ecbb92 (and at 43a5520) has nothing to do with this change. It fails because "fctl on macOS" never got a runner: GitHub cancelled the job after 15 minutes with no runner and no step run. Every other check passed. The macOS job passed at d2a592f, and a CI run elsewhere in the repository hit the same wait earlier today. At cc1156a, an empty commit that runs the checks again, the macOS job has a runner and runs.

@kalaspuff
kalaspuff merged commit d65a6b7 into main Dec 2, 2026
13 checks passed
@kalaspuff
kalaspuff deleted the fctl/1770-carl-oscar-aaro-14-02 branch December 2, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant