Skip to content

Playground: cover the leaked-fc leak on failed restore - #1131

Merged
alexey-milovidov merged 1 commit into
mainfrom
fix-tap-busy-retry
Jul 28, 2026
Merged

Playground: cover the leaked-fc leak on failed restore#1131
alexey-milovidov merged 1 commit into
mainfrom
fix-tap-busy-retry

Conversation

@alexey-milovidov

Copy link
Copy Markdown
Member

Two paths could leave a firecracker process alive after a query- triggered restore failed, holding fc-tap- and breaking the next /query with "Open tap device failed: … Resource busy (os error 16). Invalid TUN/TAP Backend provided by fc-tap-N":

  1. vm_manager._restore_snapshot: _boot's own except handler already reaps on _configure_boot failure, but if the guest agent never answers /health (_wait_for_agent) or the daemon never reports /ready (_wait_for_daemon_ready), we fall through with vm.pid still set and no cleanup. Wrap both waits and shut down the fc process + teardown_tap on failure.

  2. main._dispatch_query: even with the vm_manager fix, an out-of-band raise (e.g. an aiohttp ServerDisconnectedError before we ever entered _restore_snapshot's try) can still leak. Kick the VM before the second attempt so ensure_tap on attempt-2 always sees a clean slot.

Two paths could leave a firecracker process alive after a query-
triggered restore failed, holding fc-tap-<slot> and breaking the
next /query with "Open tap device failed: … Resource busy (os
error 16). Invalid TUN/TAP Backend provided by fc-tap-N":

1. vm_manager._restore_snapshot: _boot's own except handler already
   reaps on _configure_boot failure, but if the guest agent never
   answers /health (_wait_for_agent) or the daemon never reports
   /ready (_wait_for_daemon_ready), we fall through with vm.pid
   still set and no cleanup. Wrap both waits and shut down the fc
   process + teardown_tap on failure.

2. main._dispatch_query: even with the vm_manager fix, an out-of-band
   raise (e.g. an aiohttp ServerDisconnectedError before we ever
   entered _restore_snapshot's try) can still leak. Kick the VM
   before the second attempt so ensure_tap on attempt-2 always sees
   a clean slot.
@alexey-milovidov alexey-milovidov self-assigned this Jul 28, 2026
@alexey-milovidov
alexey-milovidov merged commit fa0fb9d into main Jul 28, 2026
3 checks passed
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.

1 participant