Fixes: shim service event blocked when waiting for IO finished#2826
Merged
estesp merged 1 commit intocontainerd:masterfrom Nov 27, 2018
Merged
Fixes: shim service event blocked when waiting for IO finished#2826estesp merged 1 commit intocontainerd:masterfrom
estesp merged 1 commit intocontainerd:masterfrom
Conversation
Signed-off-by: Lifubang <lifubang@acmcoder.com>
Codecov Report
@@ Coverage Diff @@
## master #2826 +/- ##
=======================================
Coverage 43.79% 43.79%
=======================================
Files 100 100
Lines 10741 10741
=======================================
Hits 4704 4704
Misses 5307 5307
Partials 730 730
Continue to review full report at Codecov.
|
Member
|
For the lock change, I think it is good. 👍 |
This was referenced Nov 24, 2018
Member
|
LGTM |
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.
@crosbymichael As I mentioned in #2823 , there will be a process locking state when waiting for one exec process IO finished.
I'm so sorry to say that I think this is because of your PR #2803 , you modify the location of process lock in delete func(#2624 ).
The correct location: https://github.com/Ace-Tang/containerd/blob/079292e3fc20b7319b6e7c35dcda6864bb128f1c/runtime/v1/linux/proc/exec_state.go#L170-L177
After your modify: https://github.com/containerd/containerd/blob/release/1.2/runtime/v1/linux/proc/exec.go#L103-L108
So, when exec proc A is waiting for it's IO finished, it will hold A's process lock.
When at this time, exec proc B is finished, shim service will trigger
checkProcesses(e runc.Exit), it will call A.Pid(), but A.Pid() need A's process lock, so it is stucked, and every event in shim service is blocked, I think it's very dangerous if the event buffer is full. Please see: https://github.com/crosbymichael/containerd/blob/4c72befe097fb5d9e99ede3536c884608d0af474/runtime/v1/shim/service.go#L523-L532But the PR #2624 is not perfect, because
execCreatedStateshould lock the whole func, or it will cause race situation.So, I think we should fix this problem.
There are two solutions:
execCreatedStateandexecRunningStatewhen callexec.Pid.Signed-off-by: Lifubang lifubang@acmcoder.com