Playground: cover the leaked-fc leak on failed restore - #1131
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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":
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.
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.