[18.03] ExportContainer: do not panic#468
Conversation
|
ping @kolyshkin @tonistiigi PTAL |
|
LGTM |
1 similar comment
|
LGTM |
|
We need to also add:
|
|
Added moby/moby#36610 |
|
Added moby/moby#36459 (which moves tests to the API), and moby/moby#36606 (adding an integration test) This should be ready now 👍 |
|
hmf, more changes needed in the integration-test suite; |
421e976 to
c692d7c
Compare
|
Added moby/moby#36393 "Move containerIsStopped/containerIsInState to integration/internal/container" |
|
We're not there yet 😞 (sorry for the noise); Adding:
|
c692d7c to
c243b57
Compare
One possible fix for this (other than the backporting) is -skip.If(t, testEnv.IsRemoteDaemon())
+skip.If(t, !testEnv.IsLocalDaemon()) |
|
Ah, dang, did I skip one? |
|
It's expecting this one; |
|
Looks like this is the one we'd need for that moby/moby@d896f87 (moby/moby#36292) |
c243b57 to
788f460
Compare
|
Okay, looks like I have them all now. I reorganised the commits, putting all the test-changes at the start; I can split those to a separate PR if we want to (changes to testing are also being tracked, related to running the tests in the e2e suite) Windows failure is a flaky test (would be fixed by moby/moby#36571); Windows also timed out 😞 PowerPC doesn't look related https://jenkins.dockerproject.org/job/docker-ce-pr-ppc64le/449/execution/node/452/log/ |
|
|
In case ContainerExport() is called for an unmounted container, it leads to a daemon panic as container.BaseFS, which is dereferenced here, is nil. To fix, do not rely on container.BaseFS; use the one returned from rwlayer.Mount(). Fixes: 7a7357d ("LCOW: Implemented support for docker cp + build") Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit 81f6307) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Commit 7a7357d ("LCOW: Implemented support for docker cp + build") changed `container.BaseFS` from being a string (that could be empty but can't lead to nil pointer dereference) to containerfs.ContainerFS, which could be be `nil` and so nil dereference is at least theoretically possible, which leads to panic (i.e. engine crashes). Such a panic can be avoided by carefully analysing the source code in all the places that dereference a variable, to make the variable can't be nil. Practically, this analisys are impossible as code is constantly evolving. Still, we need to avoid panics and crashes. A good way to do so is to explicitly check that a variable is non-nil, returning an error otherwise. Even in case such a check looks absolutely redundant, further changes to the code might make it useful, and having an extra check is not a big price to pay to avoid a panic. This commit adds such checks for all the places where it is not obvious that container.BaseFS is not nil (which in this case means we do not call daemon.Mount() a few lines earlier). Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit d6ea46c) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This test case checks that a container created before start of the currently running dockerd can be exported (as reported in #36561). To satisfy this condition, either a pre-existing container is required, or a daemon restart after container creation. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit 6e7141c) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: John Howard <jhoward@microsoft.com> (cherry picked from commit 0f5fe3f) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
788f460 to
a978050
Compare
|
#512 was merged, so this one is rebased and now only contains the changes related to this fix (last four commits) |
|
@andrewhsu Windows CI got stuck; can you restart? |
[master] deb: use DEBIAN_FRONTEND=noninteractive for all dockerfiles Upstream-commit: f062a0d Component: packaging
[master] deb: use DEBIAN_FRONTEND=noninteractive for all dockerfiles
Cherry-picks for 18.03 of
fixes moby/moby#36561
fixes docker/for-mac#2679
no conflicts