Wait for the gofer process in Container.Wait(). #12076
Open
+4
−2
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.
Wait for the gofer process in Container.Wait().
The linked issue is regarding
runsc run --detach=false
not waiting on thegofer (which is its child process). Because of this, if the container is killed
externally via
runsc delete
, then the gofer process becomes a zombie. Thereis a deadlock because
runsc delete
is waiting for the gofer process to bereaped but the
runsc run
process is stuck waiting for a filesystem lock heldby the
runsc delete
process before it can reap it in Container.Destroy().The fix is to also attempt reaping the child gofer process in Container.Wait().
Notice that this is similar to what Sandbox does. Both Sandbox.Wait() and
Sandbox.destroy() call Sandbox.waitForStopped() which reaps the child sandbox
process. However, only Container.Destroy() => stop() => waitForStopped(). This
change updates Container.Wait() to also call Container.waitForStopped().
This fixes the above deadlock because
runsc run
will reap the gofer beforegetting stuck waiting for the filesystem lock.
Fixes #12051