Commit graph

35708 commits

Author SHA1 Message Date
Sebastiaan van Stijn
738994f77d
Merge pull request #37778 from Microsoft/jjh/vendorhcsshim
Revendor Microsoft/hcsshim @v0.7.3
2018-09-11 14:45:24 +02:00
John Howard
ddd4adb00a Bump Microsoft/hcsshim to v0.7.3
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-09-10 10:19:32 -07:00
Sebastiaan van Stijn
77faf158f5
Merge pull request #37576 from kolyshkin/logs-f-leak
daemon.ContainerLogs(): fix resource leak on follow
2018-09-10 14:26:43 +02:00
Yong Tang
703a04ebc9
Merge pull request #37712 from Microsoft/jjh/detach
Windows: Try to detach sandbox on cleanup to avoid permission denied
2018-09-09 16:50:27 -07:00
Sebastiaan van Stijn
c1d090fcc8
Merge pull request #37801 from nashasha1/fix/some-typo
Fix typo dont->don't
2018-09-09 12:26:43 +02:00
Sebastiaan van Stijn
caca40c8ec
Merge pull request #37799 from scf0920/branch-1
fix typo: transtions->transitions
2018-09-08 11:20:41 +02:00
nashasha1
86b4cc49dd Fix dont typo
Signed-off-by: Xiaodong Zhang <a4012017@sina.com>
2018-09-08 16:58:03 +08:00
Sebastiaan van Stijn
3d9adede13
Merge pull request #37782 from jianliao82/patch-1
fix a couple of typo
2018-09-08 09:44:00 +02:00
cfshang
5750e14052 fix typo: transtions->transitions
Signed-off-by: Chengfei Shang <cfshang@alauda.io>
2018-09-08 10:06:46 +08:00
jliao
7427fe12d8 fix typo
fix typo

Signed-off-by: jian liao <jliao@alauda.io>
2018-09-08 08:13:30 +08:00
Sebastiaan van Stijn
b0bc9f6518
Merge pull request #37787 from max8899/AUTHORS
Update authors and mailmap
2018-09-07 22:38:03 +02:00
Lei Gong
c13f1f0973 Update authors and mailmap
Signed-off-by: Lei Gong <lgong@alauda.io>
2018-09-07 23:43:34 +08:00
Sebastiaan van Stijn
4b18f8c4bf
Merge pull request #37783 from tossmilestone/fix-typo-changelog
Fix various spell errors
2018-09-07 16:54:30 +02:00
Sebastiaan van Stijn
f3c4ec8c0e
Merge pull request #37788 from max8899/patch-1
fix typos
2018-09-07 16:48:48 +02:00
Sebastiaan van Stijn
e33ea4fbde
Merge pull request #37794 from Lihua93/fixtypos
Fix typos in comment
2018-09-07 16:46:46 +02:00
Doug Davis
9c3c3537ec
Merge pull request #37796 from mirake/fix-typo
Typo fix: retore -> restore
2018-09-07 06:24:35 -04:00
Sebastiaan van Stijn
ec99bd6ab8
Merge pull request #37358 from kolyshkin/go111
Bump golang to 1.11.0
2018-09-07 09:35:33 +01:00
ruicao
1ca3ea121e Typo fix: retore -> restore
Signed-off-by: ruicao <ruicao@alauda.io>
2018-09-07 13:55:31 +08:00
Lihua Tang
8df0b2de54 Fix typos in comment
Signed-off-by: Lihua Tang <lhtang@alauda.io>
2018-09-07 13:17:42 +08:00
Xiaoxi He
5c0d2a0932 Fix some typos
Signed-off-by: Xiaoxi He <xxhe@alauda.io>
2018-09-07 13:13:47 +08:00
max8899
aa05e0e30f fix typos: wether -> whether
Signed-off-by: Lei Gong <lgong@alauda.io>
2018-09-07 12:27:30 +08:00
Sebastiaan van Stijn
54b62e62f7
Merge pull request #37771 from kolyshkin/fix-8gb
vendor: update tar-split
2018-09-07 00:57:00 +01:00
Kir Kolyshkin
ce858feb6a Bump vndr
We can do that now as we're no longer carrying archive/tar.
Note that latest vndr removes vendor/ subdir so we don't have to,
thus the change in hack/validate/vendor.

While at it, re-run a new vndr version to make sure everything
that should be there is.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-06 15:24:48 -07:00
Kir Kolyshkin
10fd0516b9 Bump golang to 1.11.0
It's that time of year again! Go 1.11 is released, time to use it.

This commit also

* removes our archive/tar fork, since upstream archive/tar
  is fixed for static builds, and osusergo build tag is set.

* removes ENV GO_VERSION from Dockerfile as it's not needed
  anymore since PR #37592 is merged.

[v2: switch to beta2]
[v3: switch to beta3]
[v4: rc1]
[v5: remove ENV GO_VERSION as PR #37592 is now merged]
[v6: rc2]
[v7: final!]
[v8: use 1.11.0]
[v9: back to 1.11]
[v8: use 1.11.0]

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-06 15:24:44 -07:00
Kir Kolyshkin
8ad648b59a hack/make.ps1: remove the .0 suffix from go version
We would like to use a version with .0 suffix (like 1.11.0) in
Dockerfile, so that once a .1 version is out (like 1.11.1) we
won't accidentally switch to it.

Unfortunately it's not possible to use .0 suffix currently
as it breaks the check in make.ps1. This patch fixes that.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-06 15:24:34 -07:00
Kir Kolyshkin
32a2331103 Dockerfile.simple: simplify by using golang img
Instead of installing golang from sources, it's easier to use
golang image which is based on Debian Stretch.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-06 15:24:29 -07:00
Kir Kolyshkin
bac67204e1 vendor: bump containerd/continuity
This is to include the Go 1.11 fix
(https://github.com/containerd/continuity/pull/120).
Again (see c64a2448d1).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-06 15:24:22 -07:00
Kir Kolyshkin
09921ca33f Revendor ugorji/go
To include the following backported fix:

https://github.com/kolyshkin/ugorji-go/commit/1cf431c13dec46596

which should fix this:

> 13:40:53 vendor/github.com/ugorji/go/codec/gen-helper.generated.go:1:
> possible malformed +build comment%!(EXTRA []interface {}=[])

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-06 15:24:19 -07:00
Kir Kolyshkin
9b0097a699 Format code with gofmt -s from go-1.11beta1
This should eliminate a bunch of new (go-1.11 related) validation
errors telling that the code is not formatted with `gofmt -s`.

No functional change, just whitespace (i.e.
`git show --ignore-space-change` shows nothing).

Patch generated with:

> git ls-files | grep -v ^vendor/ | grep .go$ | xargs gofmt -s -w

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-06 15:24:16 -07:00
Tõnis Tiigi
4842f7a867
Merge pull request #37738 from tiborvass/remove-unused-field-in-builder
builder: remove unused netnsRoot field in builder-next
2018-09-06 13:33:35 -07:00
John Howard
efdad53744 Windows: DetachVhd attempt in cleanup
Signed-off-by: John Howard <jhoward@microsoft.com>

This is a fix for a few related scenarios where it's impossible to remove layers or containers
until the host is rebooted. Generally (or at least easiest to repro) through a forced daemon kill
while a container is running.

Possibly slightly worse than that, as following a host reboot, the scratch layer would possibly be leaked and
left on disk under the dataroot\windowsfilter directory after the container is removed.

One such example of a failure:

1. run a long running container with the --rm flag
docker run --rm -d --name test microsoft/windowsservercore powershell sleep 30
2. Force kill the daemon not allowing it to cleanup. Simulates a crash or a host power-cycle.
3. (re-)Start daemon
4. docker ps -a
PS C:\control> docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                PORTS               NAMES
7aff773d782b        malloc              "powershell start-sl…"   11 seconds ago      Removal In Progress                       malloc
5. Try to remove
PS C:\control> docker rm 7aff
Error response from daemon: container 7aff773d782bbf35d95095369ffcb170b7b8f0e6f8f65d5aff42abf61234855d: driver "windowsfilter" failed to remove root filesystem: rename C:\control\windowsfilter\7aff773d782bbf35d95095369ffcb170b7b8f0e6f8f65d5aff42abf61234855d C:\control\windowsfilter\7aff773d782bbf35d95095369ffcb170b7b8f0e6f8f65d5aff42abf61234855d-removing: Access is denied.
PS C:\control>

Step 5 fails.
2018-09-06 13:17:50 -07:00
Kir Kolyshkin
f845d76d04 TestFollowLogsProducerGone: add
This should test that
 - all the messages produced are delivered (i.e. not lost)
 - followLogs() exits

Loosely based on the test having the same name by Brian Goff, see
https://gist.github.com/cpuguy83/e538793de18c762608358ee0eaddc197

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-06 11:48:37 -07:00
Kir Kolyshkin
916eabd459 daemon.ContainerLogs(): fix resource leak on follow
When daemon.ContainerLogs() is called with options.follow=true
(as in "docker logs --follow"), the "loggerutils.followLogs()"
function never returns (even then the logs consumer is gone).
As a result, all the resources associated with it (including
an opened file descriptor for the log file being read, two FDs
for a pipe, and two FDs for inotify watch) are never released.

If this is repeated (such as by running "docker logs --follow"
and pressing Ctrl-C a few times), this results in DoS caused by
either hitting the limit of inotify watches, or the limit of
opened files. The only cure is daemon restart.

Apparently, what happens is:

1. logs producer (a container) is gone, calling (*LogWatcher).Close()
for all its readers (daemon/logger/jsonfilelog/jsonfilelog.go:175).

2. WatchClose() is properly handled by a dedicated goroutine in
followLogs(), cancelling the context.

3. Upon receiving the ctx.Done(), the code in followLogs()
(daemon/logger/loggerutils/logfile.go#L626-L638) keeps to
send messages _synchronously_ (which is OK for now).

4. Logs consumer is gone (Ctrl-C is pressed on a terminal running
"docker logs --follow"). Method (*LogWatcher).Close() is properly
called (see daemon/logs.go:114). Since it was called before and
due to to once.Do(), nothing happens (which is kinda good, as
otherwise it will panic on closing a closed channel).

5. A goroutine (see item 3 above) keeps sending log messages
synchronously to the logWatcher.Msg channel. Since the
channel reader is gone, the channel send operation blocks forever,
and resource cleanup set up in defer statements at the beginning
of followLogs() never happens.

Alas, the fix is somewhat complicated:

1. Distinguish between close from logs producer and logs consumer.
To that effect,
 - yet another channel is added to LogWatcher();
 - {Watch,}Close() are renamed to {Watch,}ProducerGone();
 - {Watch,}ConsumerGone() are added;

*NOTE* that ProducerGone()/WatchProducerGone() pair is ONLY needed
in order to stop ConsumerLogs(follow=true) when a container is stopped;
otherwise we're not interested in it. In other words, we're only
using it in followLogs().

2. Code that was doing (logWatcher*).Close() is modified to either call
ProducerGone() or ConsumerGone(), depending on the context.

3. Code that was waiting for WatchClose() is modified to wait for
either ConsumerGone() or ProducerGone(), or both, depending on the
context.

4. followLogs() are modified accordingly:
 - context cancellation is happening on WatchProducerGone(),
and once it's received the FileWatcher is closed and waitRead()
returns errDone on EOF (i.e. log rotation handling logic is disabled);
 - due to this, code that was writing synchronously to logWatcher.Msg
can be and is removed as the code above it handles this case;
 - function returns once ConsumerGone is received, freeing all the
resources -- this is the bugfix itself.

While at it,

1. Let's also remove the ctx usage to simplify the code a bit.
It was introduced by commit a69a59ffc7 ("Decouple removing the
fileWatcher from reading") in order to fix a bug. The bug was actually
a deadlock in fsnotify, and the fix was just a workaround. Since then
the fsnofify bug has been fixed, and a new fsnotify was vendored in.
For more details, please see
https://github.com/moby/moby/pull/27782#issuecomment-416794490

2. Since `(*filePoller).Close()` is fixed to remove all the files
being watched, there is no need to explicitly call
fileWatcher.Remove(name) anymore, so get rid of the extra code.

Should fix https://github.com/moby/moby/issues/37391

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-06 11:47:42 -07:00
Brian Goff
d37a11bfba daemon/logger/loggerutils: add TestFollowLogsClose
This test case checks that followLogs() exits once the reader is gone.
Currently it does not (i.e. this test is supposed to fail) due to #37391.

[kolyshkin@: test case Brian Goff, changelog and all bugs are by me]
Source: https://gist.github.com/cpuguy83/e538793de18c762608358ee0eaddc197

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-06 11:46:34 -07:00
Kir Kolyshkin
2e4c2a6bf9 daemon.ContainerLogs: minor debug logging cleanup
This code has many return statements, for some of them the
"end logs" or "end stream" message was not printed, giving
the impression that this "for" loop never ended.

Make sure that "begin logs" is to be followed by "end logs".

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-06 11:45:50 -07:00
Brian Goff
7aa797fe92
Merge pull request #37770 from Microsoft/jjh/TestBuildSymlinkBreakout
Windows: Go1.11: Use long path in TestBuildSymlinkBreakout
2018-09-06 11:16:46 -07:00
Sebastiaan van Stijn
f94eec2308
Merge pull request #37690 from KimMachineGun/modify-context-key
api/server, dockerversion: modify context key
2018-09-06 18:45:41 +01:00
John Howard
66966941f9 Vendor Microsoft/go-winio v0.4.11
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-09-06 09:54:24 -07:00
Kir Kolyshkin
92e7543903 vendor: update tar-split
To include https://github.com/vbatts/tar-split/pull/48 which
fixes the issue of creating an image with >8GB file in it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-06 09:43:41 -07:00
Sebastiaan van Stijn
7129bebe0a
Merge pull request #37665 from kolyshkin/dev-init
Fix docker --init with /dev bind mount
2018-09-06 13:16:10 +01:00
Kir Kolyshkin
b3165f5b2d integration/build: add TestBuildHugeFile
Add a test case for creating a 8GB file inside a container.
Due to a bug in tar-split this was failing in Docker 18.06.

The file being created is sparse, so there's not much I/O
happening or disk space being used -- meaning the test is
fast and does not require a lot of disk space.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-09-05 20:13:57 -07:00
John Howard
b1b9937bc7 Windows: Go1.11: Use long path names in build context (TestBuildSymlinkBreakout)
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-09-05 17:01:05 -07:00
Tibor Vass
53e55db9d3
Merge pull request #37758 from dmcgowan/fix-libcontainerd-supervisor
Fix supervisor healthcheck throttling
2018-09-04 23:01:28 -07:00
Tibor Vass
de53bbf92b
Merge pull request #37761 from tonistiigi/dial-tls
client: dial tls on Dialer if tls config is set
2018-09-04 21:09:17 -07:00
Tibor Vass
89dac8427e
Merge pull request #37756 from tiborvass/buildkit-vendor
vendor buildkit to fix a couple of bugs
2018-09-04 18:42:32 -07:00
Tonis Tiigi
5974fc2540 client: dial tls on Dialer if tls config is set
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-09-04 17:43:33 -07:00
Anusha Ragunathan
c129828151
Merge pull request #37666 from Yadnyawalkya/docker_names
Added two new adjectives and four new names to names-generator.go
2018-09-04 12:15:24 -07:00
Derek McGowan
c3e3293843
Fix supervisor healthcheck throttling
Fix default case causing the throttling to not be used.
Ensure that nil client condition is handled.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-09-04 11:00:28 -07:00
Tibor Vass
effa24bf48 vendor buildkit to fix a couple of bugs
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-09-04 15:17:40 +00:00
Tibor Vass
6ba1e91877
Merge pull request #37651 from tiborvass/new-builder-prune
builder: add prune options to the API
2018-09-04 07:50:09 -07:00