Conversation
|
Please sign your commits following these rules: $ git clone -b "35703-exec-kill" git@github.com:dtaniwaki/moby.git somewhere
$ cd somewhere
$ git commit --amend -s --no-edit
$ git push -fAmending updates the existing PR. You DO NOT need to open a new one. |
5c280de to
fdb822f
Compare
AkihiroSuda
left a comment
There was a problem hiding this comment.
Design looks good. Thank you
69439f2 to
880c309
Compare
|
@AkihiroSuda Thank you for reviewing my pull request. I updated the code based on your review result. Would you check it again? |
integration/container/exec_test.go
Outdated
There was a problem hiding this comment.
I'd like to have your opinion about the behavior of the exec kill feature.
Currently, it just sends a signal to the process and doesn't remove the instance from execCommands. That's why I assumed it might not finish just after calling the method. If we want to make the kill action with a synchronized manner, we have to wait for the process termination in ContainerExecKill to remove the exec instance, but it requires timeout in its option. On the other hand, if we remove the exec instance just after sending a signal to the process, we can make it synchronized easily without timeout, but have the possibility of resource leakage.
Which do you think is better?
There was a problem hiding this comment.
To consider non-force cases (TERM signal), I think ContainerExecKill should just send a signal to the running process and the caller should take care of the result just like the kill command of Linux.
8830e2b to
0e55615
Compare
Codecov Report
@@ Coverage Diff @@
## master #38704 +/- ##
==========================================
+ Coverage 36.53% 36.57% +0.03%
==========================================
Files 610 610
Lines 45395 45410 +15
==========================================
+ Hits 16584 16607 +23
+ Misses 26517 26506 -11
- Partials 2294 2297 +3 |
0e55615 to
22bc8fe
Compare
|
I think the error of janky and experimental is not related to my change. |
3d0da4e to
824a642
Compare
|
I added a test for daemon so it doesn't decrease the coverage by codecov. |
cpuguy83
left a comment
There was a problem hiding this comment.
This endpoint should really match the container kill endpoint (POST) and accept a kill signal.
824a642 to
d48ff49
Compare
|
Hmm... It's weird. The test passes in my local and the error in CI should not happen. |
|
@cpuguy83 The error windows CI failed with is weird. The same composition exists in resize test of daemon. Could you tell me possible reason of this failure? |
|
@dtaniwaki Line 1 in 0111ee7 |
integration/container/exec_test.go
Outdated
There was a problem hiding this comment.
The state of a process is checked periodically just below this line. I'd like to make sure if it's running.
There was a problem hiding this comment.
IIUC case <-ticker.C: is always executed after 1sec? Then case <-time.After(5 * time.Second): won't be executed?
There was a problem hiding this comment.
Yes, that's true. However, I put the safety guard just in case if it doesn't finish in a few seconds. I'll remove it and put a sleep of 1 second instead if it's better.
There was a problem hiding this comment.
Please refer to
moby/integration/container/exec_test.go
Lines 51 to 83 in c8e398b
There was a problem hiding this comment.
I think the code you mentioned is to wait for closed connection which can block until disconnection. The test I wrote uses detach option in ContainerExecCreate, and ContainerExecInspect may return not found error or a response with Running=false without blocking. Could you tell me how to wait for an active exec instance in more detail?
ce4cb29 to
342d072
Compare
Signed-off-by: Daisuke Taniwaki <daisuketaniwaki@gmail.com>
342d072 to
c8e398b
Compare
|
Windows does not use containerd. |
|
Will this PR be re-reviewed at some point? It would be great to have it. It would allow to make |
|
needs rebase |
|
@AkihiroSuda I've given a shot to try to rebase it here: #41548 I pre-apologize if it just explodes in the CI, I've never used Go before, neither I knew how to build the project to test it. |
|
Thanks @awesomebytes
Testing Moby is quite different from other Go programs; the test scripts can be locally executed by running |
|
Thanks for the link @AkihiroSuda I'll try to fix things locally before further spamming your CI system. |
|
I'm closing this PR as the implementation is taken over to #41548 thanks to @awesomebytes and @adamjseitz. |
Closes #35703 #9098
- What I did
I implemented a feature to kill exec instance.
- How I did it
I added an API endpoint for the action and a method to call it in the client, then implemented an exec action in the daemon.
- How to verify it
docker run --name exec-kill -d ubuntu:16.04 sleep infinitydocker exec -d exec-kill sleep 99999. (use different sleep time from the container command to easily identify it)ps aux.docker inspect exec-kill | grep ExecIDs -A 3.curl --unix-socket /var/run/docker.sock -X DELETE "http:/v1.40/exec/<EXEC_ID>".ps aux.- Description for the changelog
Add exec kill feature with API endpoint and a client method
- A picture of a cute animal (not mandatory but encouraged)