Fix #30311: dockerd leaks ExecIds on failed exec -i#30340
Fix #30311: dockerd leaks ExecIds on failed exec -i#30340AkihiroSuda merged 1 commit intomoby:masterfrom
Conversation
AkihiroSuda
left a comment
There was a problem hiding this comment.
Can you please add an automated test?
daemon/exec.go
Outdated
There was a problem hiding this comment.
Probably no need to move these lines?
There was a problem hiding this comment.
It's necessary to use c in defer
|
added tests |
|
On windows |
|
Should be a 4xx error.
…On 22 Jan 2017 19:20, "ijrandom" ***@***.***> wrote:
On windows docker exec invalidcommand produce 500 and on linux 404. Which
one need to be corrected?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#30340 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAdcPKvRatzY5wPrHW17uiZV0gJ-wZz0ks5rU6wLgaJpZM4LqC8B>
.
|
|
ping @docker/core-engine-maintainers |
api/server/httputils/errors.go
Outdated
There was a problem hiding this comment.
Can we avoid expanding this "guess the status code" system further and return a specific http error instead?
There was a problem hiding this comment.
Sure, I'd be happy to.
This code that you've added to is trying to guess which http status code to return based on an error message string. Instead of guessing based on string matching, we'd like to be explicit about the error.
The explicit error is in api/errors/errors.go NewRequestNotFoundError(). Could you return that directly from the function that causes this error, instead of adding a new string to this list?
There was a problem hiding this comment.
Just to be clear. You want to return NewRequestNotFoundError from platform specific wrapper to execv/CreateProcess?
There was a problem hiding this comment.
Where is the error which contains the text "cannot find"?
There was a problem hiding this comment.
It come from the windows os when CreateProcess failed
There was a problem hiding this comment.
Ok, is there an issue about this? I don't think we return a 404 on other platforms when the path to a binary is incorrect.
There was a problem hiding this comment.
on linux message contains "not found" those producing 404
daemon/exec.go
Outdated
There was a problem hiding this comment.
Doesn't this needs to be protected by the lock?
There was a problem hiding this comment.
Only if changes to ec.Running and ec.ExitCode need to be atomic. There were no lock protection in containerd callback - so I added no lock here. Should I add the lock? Add the lock in containerd callback as well?
There was a problem hiding this comment.
Sorry. There was a lock. Added lock/unlock and changed message
daemon/exec.go
Outdated
There was a problem hiding this comment.
maybe add some context? e.g. "failed to cleanup exec %s streams: %s"?
There was a problem hiding this comment.
done, also changed message in monitor.go
There was a problem hiding this comment.
you can use inspectFieldJSON (https://github.com/docker/docker/blob/master/integration-cli/docker_utils_test.go#L554) instead.
The fix LGTM.
It's better to squash your commits :)
cpuguy83
left a comment
There was a problem hiding this comment.
Let's makes sure to squash to 1 commit
Signed-off-by: Dmitry Shyshkin <dmitry@shyshkin.org.ua>
|
rebased and squashed |
upstream issue: moby#30311 Cherry-pick from moby#30340 fix moby#161 Signed-off-by: Dmitry Shyshkin <dmitry@shyshkin.org.ua> Signed-off-by: Lei Jitang <leijitang@huawei.com>
Fix docker leaks ExecIds on failed exec -i upstream issue: moby#30311 Cherry-pick from moby#30340 fix moby#161 Signed-off-by: Dmitry Shyshkin <dmitry@shyshkin.org.ua> Signed-off-by: Lei Jitang <leijitang@huawei.com> See merge request docker/docker!275
If libcontainerd failed to start process there will be no callback about "exec done" so cleanup code should be added to ContainerExecStart
Signed-off-by: Dmitry Shyshkin dmitry@shyshkin.org.ua
- What I did
Close streams and removed ExecConfig from container in case of process failed to start
- How I did it
Copy part of cleanup code from containerd exec callback
- How to verify it
- Description for the changelog
Fix #30311: dockerd leaks ExecIds on failed exec -i