Fixed container init process not re-parent to youki main process#1637
Merged
utam0k merged 1 commit intoyouki-dev:mainfrom Mar 11, 2023
Merged
Fixed container init process not re-parent to youki main process#1637utam0k merged 1 commit intoyouki-dev:mainfrom
utam0k merged 1 commit intoyouki-dev:mainfrom
Conversation
Collaborator
Author
|
See this comment for more discussion: #1601 (comment) |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1637 +/- ##
==========================================
+ Coverage 68.93% 68.95% +0.01%
==========================================
Files 120 120
Lines 13156 13157 +1
==========================================
+ Hits 9069 9072 +3
+ Misses 4087 4085 -2 |
5369ab7 to
9632c06
Compare
Signed-off-by: Eric Fang <yihuaf@unkies.org>
utam0k
reviewed
Mar 10, 2023
utam0k
reviewed
Mar 10, 2023
5 tasks
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.
Fix #1601
In this PR, I decided to clone
intermediateprocess as child and then clone the container init process as sibling of theintermediateprocess and child ofyouki mainprocess. In this way, when intermediate process exits, the container init process will not re-parent to pid 1 and become zombie. The caller of youki can decide to use subreaper flag to adopt the container init process when youki main process exits.This method cleaner because youki main process is guaranteed to be the parent of both intermediate process and container init process at all time. There is no extra re-parenting.
This PR is only part of the fix. We do need to revisit the detached and foreground mode. Not everything is fixed, but this PR should maintain the old behavior on anything that it does not fix.