exec lock optimize when waiting for io close if no terminal#2823
exec lock optimize when waiting for io close if no terminal#2823lifubang wants to merge 1 commit intocontainerd:masterfrom
Conversation
|
The other exec processes will be waiting here. And |
|
@lifubang the wg.Wait() is used to make sure that the BTW, could you provide the image and |
|
All in #2624 |
|
Why if |
Yes, it should be waiting IO to close by itself. But other exec should not stuck. |
for container with in this example, init process is |
973e45f to
951874c
Compare
|
I have update the code. |
|
If hold this lock in Delete(), the command |
Codecov Report
@@ Coverage Diff @@
## master #2823 +/- ##
=======================================
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.
|
|
It will cause |
|
@Ace-Tang Thanks your explain for |
|
TO Don't hold the lock, just check the lock may be more safe.~~ |
951874c to
f7ff822
Compare
|
|
f7ff822 to
1bb5e16
Compare
|
@thaJeztah this will cause docker container in unhealthy state. In this time, it is healty: If I run: It will wait 100s. After about 5 seconds, the container will become unhealthy: After 100s, it will become healthy state again. PTAL |
1bb5e16 to
cc4635b
Compare
Signed-off-by: Lifubang <lifubang@acmcoder.com>
|
Yes, we can hold the lock in |
|
With the last commit:
For |
|
I would like to explain how exec without terminal hang if child processes forked from exec process are still alive. Shim uses The However, I think that it is reasonable. If the background job can output the data, like @lifubang if you can provide the use case, it will be helpful. Thanks |
@fuweid yes, this is reasonable. |
|
For this patch, we can use a Coarse-grained lock, so don't need modify current lock. |
|
As #2826 is merged, so this can be closed. Thanks all the reviewers. |
For this patch: #2624
If run with
-t, it will exit success:But if run without
-t, it will wait:It is still wait for io finished because of
e.wg.Wait().It will cause other exec process and
ctr t psstuck.And will cause
processExitsandcheckProcessesstuck.If the waiting time is too long, and health check in docker will stuck too.
I think this just like #2807, because when delete, no one sends signal to io to close it.So, we need to send a signal to io beforee.wg.Wait().https://github.com/lifubang/containerd/blob/973e45f38b52a181f5f9d46dafb899f5327fa7d5/runtime/v1/linux/proc/exec.go#L110-L117The produce step is in #2624
Signed-off-by: Lifubang lifubang@acmcoder.com