Fix container start hang on invalid executable - #1278
Merged
Conversation
Stopped state is an irrecoverable state where the VM is shutdown, and cannot boot VM again. Stopped state has a non-nil exit code if the container successfully ran and exited inside the VM. Otherwise, something error happens while `bootstrap` or `startInitProcess`. When the container exits too early (before start waiting), the exitCode is set -1, which might give confusion whether it's real exitcode or not.
Contributor
|
This feels like a design/implementation failure on |
Contributor
|
Oh never mind this PR is now entirely different from my first viewing LOL |
dcantah
approved these changes
Mar 2, 2026
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.
This PR fixes container hang when starting an invalid executable (#1277).
Current
ProcessIO.handleProcesshas races betweenprocess.wait()andprocess.start(). Inprocess.wait,SandboxService.waitregisters and block on a continuation so that later exit of thatLinuxContainercan resume it.Even if
SandboxService.waitchecks the container state, there can be a race so thatSandboxService.startInitProcessfails earlier with no continuation to resume, thenSandboxService.waitregisters the continuation, which forever hang the thread.The root cause is because
SandboxService.waitersis not updated atomically, so this PR adds mutex to protect updatingSandboxService.waitersafter checking it's in the correct state.Type of Change
Motivation and Context
Starting a container with invalid executable hangs the terminal.
Testing