Commit graph

440 commits

Author SHA1 Message Date
Brian Goff
2c682d5209 Use containerd client Reconnect() API.
This fixes an issue where the containerd client is cached in a container
object in libcontainerd and becomes stale after containerd is restarted.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-03-28 09:43:08 -04:00
Brian Goff
f81172b903 Make sure plugin container is removed on failure
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-03-28 09:07:24 -04:00
Shukui Yang
a50d9c0765 Add if judgment before receiving operations on daemonWaitCh
receive operations on a nil channel will always block, this lead containerd not started.

Signed-off-by: Shukui Yang <yangshukui@huawei.com>
2018-03-21 05:53:55 -04:00
Daniel Nephin
6be0f70983 Automated migration using
gty-migrate-from-testify --ignore-build-tags

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-16 11:03:43 -04:00
Brian Goff
04a0d6b863 Change containerd monitor ticker to sleep
With the ticker this could end up just doing back-to-back checks, which
isn't really what we want here.
Instead use a sleep to ensure we actually sleep for the desired
interval.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-03-13 13:20:19 -04:00
John Howard
d4f37c0885 Windows: Remove servicing mode
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-02-27 08:48:31 -08:00
Yong Tang
66e6beeb24
Merge pull request #35967 from Microsoft/jjh/32838-pass-container-shutdown-error-back
Windows: Pass back system errors on container exit
2018-02-22 19:12:10 -08:00
John Howard
8c52560ea4 Windows: Pass back system errors on container exit
Signed-off-by: John Howard <jhoward@microsoft.com>

While debugging #32838, it was found (https://github.com/moby/moby/issues/32838#issuecomment-356005845) that the utility VM in some circumstances was crashing. Unfortunately, this was silently thrown away, and as far as the build step (also applies to docker run) was concerned, the exit code was zero and the error was thrown away. Windows containers operate differently to containers on Linux, and there can be legitimate system errors during container shutdown after the init process exits. This PR handles this and passes the error all the way back to the client, and correctly causes a build step running a container which hits a system error to fail, rather than blindly trying to keep going, assuming all is good, and get a subsequent failure on a commit.

With this change, assuming an error occurs, here's an example of a failure which previous was reported as a commit error:

```
The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; Install-WindowsFeature -Name Web-App-Dev ;   Install-WindowsFeature -Name ADLDS;   Install-WindowsFeature -Name Web-Mgmt-Compat;   Install-WindowsFeature -Name Web-Mgmt-Service;   Install-WindowsFeature -Name Web-Metabase;   Install-WindowsFeature -Name Web-Lgcy-Scripting;   Install-WindowsFeature -Name Web-WMI;   Install-WindowsFeature -Name Web-WHC;   Install-WindowsFeature -Name Web-Scripting-Tools;   Install-WindowsFeature -Name Web-Net-Ext45;   Install-WindowsFeature -Name Web-ASP;   Install-WindowsFeature -Name Web-ISAPI-Ext;   Install-WindowsFeature -Name Web-ISAPI-Filter;   Install-WindowsFeature -Name Web-Default-Doc;   Install-WindowsFeature -Name Web-Dir-Browsing;   Install-WindowsFeature -Name Web-Http-Errors;   Install-WindowsFeature -Name Web-Static-Content;   Install-WindowsFeature -Name Web-Http-Redirect;   Install-WindowsFeature -Name Web-DAV-Publishing;   Install-WindowsFeature -Name Web-Health;   Install-WindowsFeature -Name Web-Http-Logging;   Install-WindowsFeature -Name Web-Custom-Logging;   Install-WindowsFeature -Name Web-Log-Libraries;   Install-WindowsFeature -Name Web-Request-Monitor;   Install-WindowsFeature -Name Web-Http-Tracing;   Install-WindowsFeature -Name Web-Stat-Compression;   Install-WindowsFeature -Name Web-Dyn-Compression;   Install-WindowsFeature -Name Web-Security;   Install-WindowsFeature -Name Web-Windows-Auth;   Install-WindowsFeature -Name Web-Basic-Auth;   Install-WindowsFeature -Name Web-Url-Auth;   Install-WindowsFeature -Name Web-WebSockets;   Install-WindowsFeature -Name Web-AppInit;   Install-WindowsFeature -Name NET-WCF-HTTP-Activation45;   Install-WindowsFeature -Name NET-WCF-Pipe-Activation45;   Install-WindowsFeature -Name NET-WCF-TCP-Activation45;' returned a non-zero code: 4294967295: container shutdown failed: container ba9c65054d42d4830fb25ef55e4ab3287550345aa1a2bb265df4e5bfcd79c78a encountered an error during WaitTimeout: failure in a Windows system call: The compute system exited unexpectedly. (0xc0370106)
```

Without this change, it would be incorrectly reported such as in this comment: https://github.com/moby/moby/issues/32838#issuecomment-309621097

```
Step 3/8 : ADD buildtools C:/buildtools
re-exec error: exit status 1: output: time="2017-06-20T11:37:38+10:00" level=error msg="hcsshim::ImportLayer failed in Win32: The system cannot find the path specified. (0x3) layerId=\\\\?\\C:\\ProgramData\\docker\\windowsfilter\\b41d28c95f98368b73fc192cb9205700e21
6691495c1f9ac79b9b04ec4923ea2 flavour=1 folder=C:\\Windows\\TEMP\\hcs232661915"
hcsshim::ImportLayer failed in Win32: The system cannot find the path specified. (0x3) layerId=\\?\C:\ProgramData\docker\windowsfilter\b41d28c95f98368b73fc192cb9205700e216691495c1f9ac79b9b04ec4923ea2 flavour=1 folder=C:\Windows\TEMP\hcs232661915
```
2018-02-22 08:53:43 -08:00
John Stephens
bf1345d0b6
Merge pull request #36268 from Microsoft/jjh/rs3-bump
Windows: Bump to final RS3 build number
2018-02-12 14:49:33 -08:00
John Howard
c04504383a Windows: Bump to final RS3 build number
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-02-09 11:39:57 -08:00
Brian Goff
c0d56ab717 Fix container cleanup on daemon restart
When the daemon restores containers on daemon restart, it syncs up with
containerd to determine the existing state. For stopped containers it
then removes the container metadata from containerd.

In some cases this is not handled properly and causes an error when
someone attempts to start that container again.
In particular, this case is just a bad error check.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-02-09 14:36:36 -05:00
Yong Tang
384ff69f2f
Merge pull request #36173 from cpuguy83/fix_containerd_crash_spin
Refresh containerd remotes on containerd restarted
2018-02-08 06:19:29 -08:00
Brian Goff
400126f869 Refresh containerd remotes on containerd restarted
Before this patch, when containerd is restarted (due to a crash, or
kill, whatever), the daemon would keep trying to process the event
stream against the old socket handles. This would lead to a CPU spin due
to the error handling when the client can't connect to containerd.

This change makes sure the containerd remote client is updated for all
registered libcontainerd clients.

This is not neccessarily the ideal fix which would likely require a
major refactor, but at least gets things to a working state with a
minimal patch.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-02-07 11:53:00 -05:00
Daniel Nephin
4f0d95fa6e Add canonical import comment
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-02-05 16:51:57 -05:00
Brian Goff
d453fe35b9 Move api/errdefs to errdefs
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-01-11 21:21:43 -05:00
Brian Goff
87a12421a9 Add helpers to create errdef errors
Instead of having to create a bunch of custom error types that are doing
nothing but wrapping another error in sub-packages, use a common helper
to create errors of the requested type.

e.g. instead of re-implementing this over and over:

```go
type notFoundError struct {
  cause error
}

func(e notFoundError) Error() string {
  return e.cause.Error()
}

func(e notFoundError) NotFound() {}

func(e notFoundError) Cause() error {
  return e.cause
}
```

Packages can instead just do:

```
  errdefs.NotFound(err)
```

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-01-11 21:21:43 -05:00
Daniel Nephin
9d20d5eb3f Fix libcontainerd/client.Restore() handling of io cleanup
Make the behvious of cleaning up DirectIO more obvious

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-01-09 12:03:02 -05:00
Daniel Nephin
d72dfbfa8d Use cio.FIFOSet.Close() to cleanup fifos
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-01-09 12:00:28 -05:00
Daniel Nephin
3fec7c0858 Remove libcontainerd.IOPipe
replaced with cio.DirectIO

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-01-09 12:00:28 -05:00
Yong Tang
94b8a116fb
Merge pull request #35957 from crosbymichael/ramdisk
Honor DOCKER_RAMDISK with containerd 1.0
2018-01-08 17:38:17 -08:00
Daniel Nephin
9b62d4ffa3 Use errdefs instead of string contains for checking not found
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-01-08 14:32:39 -05:00
Michael Crosby
54051e9e64 Honor DOCKER_RAMDISK with containerd 1.0
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-01-08 12:01:03 -05:00
Sebastiaan van Stijn
295bb09184
Fix event filter filtering on "or"
The event filter used two separate filter-conditions for
"namespace" and "topic". As a result, both events matching
"topic" and events matching "namespace" were subscribed to,
causing events to be handled both by the "plugin" client, and
"container" client.

This patch rewrites the filter to match only if both namespace
and topic match.

Thanks to Stephen Day for providing the correct filter :)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-12-29 02:47:56 +01:00
Brian Goff
647cec4324 Fix some missing synchronization in libcontainerd
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-12-15 12:54:38 -05:00
Brian Goff
e55bead518 Fix error handling for kill/process not found
With the contianerd 1.0 migration we now have strongly typed errors that
we can check for process not found.
We also had some bad error checks looking for `ESRCH` which would only
be returned from `unix.Kill` and never from containerd even though we
were checking containerd responses for it.

Fixes some race conditions around process handling and our error checks
that could lead to errors that propagate up to the user that should not.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-12-15 10:09:55 -05:00
Sebastiaan van Stijn
5c3418e38b
Fix typo in log-message
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-12-11 10:59:51 -08:00
Michael Crosby
a27abc619c Fix event filters
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-12-05 09:55:33 -05:00
Michael Crosby
aa3ce07c41 Update daemon code for containerd API changes
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-30 09:55:03 -05:00
John Howard
f11f351ae7 Windows: Fix width/height swap
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-11-28 12:19:46 -08:00
Brian Goff
b86746d60d Cancelation errors should not be logged
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-11-14 20:32:20 -05:00
Sebastiaan van Stijn
b4fbcd80c7
Merge pull request #35465 from cpuguy83/update_containerd
Update containerd to v1 beta3
2017-11-14 14:01:48 +01:00
Tonis Tiigi
6c4ce7cb6c libcontainerd: fix leaking container/exec state
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-11-13 15:48:21 -08:00
Brian Goff
d3f934e304 Update containerd to v1 beta3
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-11-10 15:44:10 -05:00
Sebastiaan van Stijn
fec2b144fe
Use containerd API to get version
The `docker info` code was shelling out to obtain the
version of containerd (using the `--version` flag).

Parsing the output of this version string is error-prone,
and not needed, as the containerd API can return the
version.

This patch adds a `Version()` method to the containerd Client
interface, and uses this to get the containerd version.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-11-03 01:46:58 +01:00
Yong Tang
4785f1a7ab Remove solaris build tag and `contrib/mkimage/solaris
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-11-02 00:01:46 +00:00
John Howard
71651e0b80 Fixes LCOW after containerd 1.0 introduced regressions
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-10-27 09:55:43 -07:00
Kenfe-Mickael Laventure
ddae20c032
Update libcontainerd to use containerd 1.0
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-10-20 07:11:37 -07:00
Sebastiaan van Stijn
7cbbbb9509 Merge pull request #34846 from Microsoft/jjh/debuggcs
LCOW: Add UVM debugability by grabbing logs before tear-down
2017-09-19 22:33:46 +02:00
John Howard
2798576b37 Revendor Microsoft/opengcs @ v0.3.4
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-09-19 09:56:23 -07:00
Simon Ferquel
e89b6e8c2d Volume refactoring for LCOW
Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2017-09-14 12:33:31 -07:00
John Howard
5a0e2beac3 LCOW: Add GCS debugging
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-09-13 14:54:34 -07:00
Daniel Nephin
f7f101d57e Add gosimple linter
Update gometalinter

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-12 12:09:59 -04:00
John Howard
17a24034bb LCOW: VHDX boot to read-only
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-09-06 10:55:19 -07:00
Yong Tang
cb952bf006 Merge pull request #34625 from dnephin/more-linters
Add interfacer and unconvert linters
2017-09-01 08:46:08 -07:00
John Howard
285bc99731 Merge pull request #34356 from mlaventure/update-containerd
Update containerd to 06b9cb35161009dcb7123345749fef02f7cea8e0
2017-08-24 14:25:44 -07:00
Daniel Nephin
2f5f0af3fd Add unconvert linter
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-24 15:08:31 -04:00
Yong Tang
e5cdaf1bd9 Merge pull request #34451 from Microsoft/jjh/bootvhdx
LCOW: Additional flags for VHD boot
2017-08-24 08:38:19 -07:00
Darren Stahl
7c29103ad9
Update Windows and LCOW to use v1.0.0 runtime-spec
Signed-off-by: Darren Stahl <darst@microsoft.com>
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-21 15:19:31 -07:00
Daniel Nephin
372670b507 Add goimports to linters.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-21 18:15:08 -04:00
Kenfe-Mickael Laventure
45d85c9913
Update containerd to 06b9cb35161009dcb7123345749fef02f7cea8e0
This also update:
 - runc to 3f2f8b84a77f73d38244dd690525642a72156c64
 - runtime-specs to v1.0.0

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-21 12:04:07 -07:00
John Howard
ee0587a45d jhoward/opengcs --> Microsoft/opengcs
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-08-08 14:43:43 -07:00
John Howard
71328a7af5 LCOW: Additional flags for VHD boot
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-08-08 14:40:33 -07:00
John Starks
54354db850 Windows: Add named pipe mount support
Current insider builds of Windows have support for mounting individual
named pipe servers from the host to the guest. This allows, for example,
exposing the docker engine's named pipe to a container.

This change allows the user to request such a mount via the normal bind
mount syntax in the CLI:

  docker run -v \\.\pipe\docker_engine:\\.\pipe\docker_engine <args>

Signed-off-by: John Starks <jostarks@microsoft.com>
2017-08-07 11:34:36 -07:00
John Howard
ffdef6255e LCOW: Remove hard-coding
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-08-03 16:10:25 -07:00
Derek McGowan
1009e6a40b
Update logrus to v1.0.1
Fixes case sensitivity issue

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-07-31 13:16:46 -07:00
Christopher Jones
069fdc8a08
[project] change syscall to /x/sys/unix|windows
Changes most references of syscall to golang.org/x/sys/
Ones aren't changes include, Errno, Signal and SysProcAttr
as they haven't been implemented in /x/sys/.

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>

[s390x] switch utsname from unsigned to signed

per 33267e036f
char in s390x in the /x/sys/unix package is now signed, so
change the buildtags

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
2017-07-11 08:00:32 -04:00
Vincent Demeester
359ed99352 Merge pull request #33835 from Microsoft/jjh/changedir
LCOW: Change directory from lcow to "Linux Containers"
2017-06-27 09:33:38 +02:00
John Howard
2c43cbe0d5 LCOW: Change to c:\Program Files\Linux Containers
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-06-26 21:26:18 -07:00
John Starks
19645521a9 LCOW: pass command arguments without extra quoting
Signed-off-by: John Starks <jostarks@microsoft.com>
2017-06-24 10:23:17 -07:00
John Howard
25a65a185b Merge pull request #33785 from Microsoft/jjh/hcsschemaupdate
LCOW: Updates necessary due to platform schema change
2017-06-23 13:08:13 -07:00
John Howard
330913cadf LCOW: Update for platforms latest schema
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-06-22 14:07:23 -07:00
Sebastiaan van Stijn
f88626b270 Merge pull request #33764 from keloyang/fix-queue-mem-leak
Fix mem leak in libcontainerd/queue/append
2017-06-22 10:57:07 -07:00
Vincent Demeester
c85f92de15 Merge pull request #33774 from Microsoft/jjh/lcow-networking
LCOW: owner and network endpoints
2017-06-22 16:40:50 +02:00
yangshukui
5425a5ab84 fix mem leak in libcontainerd/queue/append
Signed-off-by: yangshukui <yangshukui@huawei.com>
2017-06-22 16:47:47 +08:00
Sebastiaan van Stijn
4fc2710dc7 Merge pull request #33772 from cpuguy83/optimizations
Don't json marshal then immediately unmarshal
2017-06-22 01:19:08 -07:00
John Howard
e99a633720 LCOW: owner and network endpoints
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-06-21 22:35:30 -07:00
Brian Goff
8d588d9c5b Don't json marshal then immediately unmarshal
During container startup we end up spending a fair amount of time
encoding/decoding json.
This cuts out some of that since we already have the decoded object in
memory.

The old flow looked like:

1. Start container request
2. Create file
3. Encode container spec to json
4. Write to file
5. Close file
6. Open file
7. Read file
8. Decode container spec
9. Close file
10. Send to containerd.

The new flow cuts out steps 6-9 completely, and with it a lot of time
spent in reflect and file IO.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-06-21 15:18:01 -07:00
John Howard
ed10ac6ee9 LCOW: Create layer folders with correct ACL
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-06-20 19:50:12 -07:00
John Howard
f154588226 LCOW: OCI Spec and Environment for container start
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-06-20 19:50:11 -07:00
Daniel Nephin
6150ebf7b4 Remove MkdirAllNewAs and update tests.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-07 11:44:34 -04:00
Sebastiaan van Stijn
56da020e6b Merge pull request #33496 from Microsoft/jjh/removedummy
Windows: Correct comment
2017-06-03 01:07:26 +02:00
John Howard
6e33c4158c Windows: Correct comment
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-06-02 11:51:30 -07:00
Wentao Zhang
d3d8c77d19 Limit max backoff delay to 2 seconds for GRPC connection
Docker use default GRPC backoff strategy to reconnect to containerd when
connection is lost. and the delay time grows exponentially, until reaches 120s.

So Change the max delay time to 2s to avoid docker and containerd
connection failure.

Signed-off-by: Wentao Zhang <zhangwentao234@huawei.com>
2017-06-02 18:19:09 +08:00
Evan Hazlett
d7c125791a Merge pull request #32590 from moypray/containerd
Fix when containerd restarted, event handler may exit
2017-06-01 08:16:24 -04:00
Antonio Murdaca
27087eacbf
libcontainerd: fix reaper goroutine position
It has observed defunct containerd processes accumulating over
time while dockerd was permanently failing to restart containerd.
Due to a bug in the runContainerdDaemon() function, dockerd does not clean up
its child process if containerd already exits very soon after the (re)start.

The reproducer and analysis below comes from docker 1.12.x but bug
still applies on latest master.

- from libcontainerd/remote_linux.go:

  329 func (r *remote) runContainerdDaemon() error {
   :
   :      // start the containerd child process
   :
  403     if err := cmd.Start(); err != nil {
  404             return err
  405     }
   :
   :      // If containerd exits very soon after (re)start, it is
possible
   :      // that containerd is already in defunct state at the time
when
   :      // dockerd gets here. The setOOMScore() function tries to
write
   :      // to /proc/PID_OF_CONTAINERD/oom_score_adj. However, this
fails
   :      // with errno EINVAL because containerd is defunct. Please see
   :      // snippets of kernel source code and further explanation
below.
   :
  407     if err := setOOMScore(cmd.Process.Pid, r.oomScore); err != nil
{
  408             utils.KillProcess(cmd.Process.Pid)
   :
   :              // Due to the error from write() we return here. As
the
   :              // goroutine that would clean up the child has not
been
   :              // started yet, containerd remains in the defunct
state
   :              // and never gets reaped.
   :
  409             return err
  410     }
   :
  417     go func() {
  418             cmd.Wait()
  419             close(r.daemonWaitCh)
  420     }() // Reap our child when needed
   :
  423 }

This is the kernel function that gets invoked when dockerd tries to
write
to /proc/PID_OF_CONTAINERD/oom_score_adj.

- from fs/proc/base.c:

 1197 static ssize_t oom_score_adj_write(struct file *file, ...
 1198                                         size_t count, loff_t
*ppos)
 1199 {
   :
 1223         task = get_proc_task(file_inode(file));
   :
   :          // The defunct containerd process does not have a virtual
   :          // address space anymore, i.e. task->mm is NULL. Thus the
   :          // following code returns errno EINVAL to dockerd.
   :
 1230         if (!task->mm) {
 1231                 err = -EINVAL;
 1232                 goto err_task_lock;
 1233         }
   :
 1253 err_task_lock:
   :
 1257         return err < 0 ? err : count;
 1258 }

The purpose of the following program is to demonstrate the behavior of
the oom_score_adj_write() function in connection with a defunct process.

$ cat defunct_test.c

\#include <unistd.h>

main()
{
    pid_t pid = fork();

    if (pid == 0)
        // child
        _exit(0);

    // parent
    pause();
}

$ make defunct_test
cc     defunct_test.c   -o defunct_test

$ ./defunct_test &
[1] 3142

$ ps -f | grep defunct_test | grep -v grep
root      3142  2956  0 13:04 pts/0    00:00:00 ./defunct_test
root      3143  3142  0 13:04 pts/0    00:00:00 [defunct_test] <defunct>

$ echo "ps 3143" | crash -s
  PID    PPID  CPU       TASK        ST  %MEM     VSZ    RSS  COMM
  3143   3142   2  ffff880035def300  ZO   0.0       0      0
defunct_test

$ echo "px ((struct task_struct *)0xffff880035def300)->mm" | crash -s
$1 = (struct mm_struct *) 0x0
                          ^^^ task->mm is NULL

$ cat /proc/3143/oom_score_adj
0

$ echo 0 > /proc/3143/oom_score_adj
-bash: echo: write error: Invalid argument"

---

This patch fixes the above issue by making sure we start the reaper
goroutine as soon as possible.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-27 15:13:59 +02:00
Wentao Zhang
02ce73f62e Fix when containerd restarted, event handler may exit
Description:
Kill docker-containerd continuously, and use kill -SIGUSR1 <dockerpid>
to check docker callstacks. And we will find that event
handler: startEventsMonitor or handleEventStream will exit.

This will only happen when system is busy, containerd need more time to
startup, and the monitor gorotine maybe exit.

Signed-off-by: Wentao Zhang <zhangwentao234@huawei.com>
2017-05-25 17:32:05 +08:00
John Howard
2f038c2586 Windows: Remove unused SandboxPath
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-05-24 13:44:35 -07:00
Darren Stahl
425973cbb8 Use CpuMaximum instead of CpuPercent for more precision
Signed-off-by: Darren Stahl <darst@microsoft.com>
2017-05-19 12:33:14 -07:00
Tõnis Tiigi
e103125883 Merge pull request #32986 from moypray/containerd_close
fix when rpc reports "transport is closing" error, health check go routine will exit
2017-05-17 17:04:05 -07:00
Kenfe-Mickael Laventure
0ea0b2becf Use containerd Status variable when checking container state
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-05-15 10:53:51 -07:00
Deng Guangxing
9771780a01 fix inconsistent state string with containerd
should be `stopped` according to containerd:
  https://github.com/containerd/containerd/blob/v0.2.x/runtime/runtime.go#L104

Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
2017-05-15 10:53:51 -07:00
Michael Crosby
005506d36c Update moby to runc and oci 1.0 runtime final rc
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-05-05 13:45:45 -07:00
Wentao Zhang
60742f9a95 fix when rpc reports "transport is closing" error, health check go routine will exit
Signed-off-by: Wentao Zhang <zhangwentao234@huawei.com>
2017-05-04 00:52:10 +08:00
Darren Stahl
dbdc8bbee4 Wait to delete container when restoring on Windows
Signed-off-by: Darren Stahl <darst@microsoft.com>
2017-03-31 10:59:00 -07:00
Tibor Vass
caf8d884aa Merge pull request #31629 from darrenstahlmsft/ShutdownLock
Windows: Stop holding client container lock during shutdown
2017-03-23 18:16:56 -07:00
Vincent Demeester
2fca6526d6 Merge pull request #31503 from Microsoft/jjh/cleanuphcsonrestore
Windows: Cleanup HCS on restore
2017-03-13 13:43:35 +01:00
Kenfe-Mickael Laventure
c458d3bb98 Handle paused container when restoring without live-restore set
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-03-09 13:37:08 -08:00
Darren Stahl
b819ffdb20 Stop holding client container lock during shutdown
Signed-off-by: Darren Stahl <darst@microsoft.com>
2017-03-07 16:24:34 -08:00
John Howard
f59593cbd1 Windows: Cleanup HCS on restore
Signed-off-by: John Howard <jhoward@microsoft.com>

This ensures that any compute processes in HCS are cleanedup
during daemon restore. Note Windows cannot (currently) reconnect
to containers on restore.
2017-03-02 15:13:12 -08:00
Madhan Raj Mookkandy
040afcce8f (*) Support --net:container:<containername/id> for windows
(*) (vdemeester) Removed duplicate code across Windows and Unix wrt Net:Containers
(*) Return unsupported error for network sharing for hyperv isolation containers

Signed-off-by: Madhan Raj Mookkandy <MadhanRaj.Mookkandy@microsoft.com>
2017-02-28 20:03:43 -08:00
John Howard
b7106a92f2 Windows: Remove unused commandLine
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-02-02 11:16:11 -08:00
Vincent Demeester
c0a1d2e0d8 Merge pull request #30117 from msabansal/natfix
Added support for dns-search and fixes #30102
2017-01-31 11:05:29 +01:00
John Howard
f47e417466 Windows: Remove GetPidsForContainer
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-01-18 12:28:52 -08:00
msabansal
e6962481a0 Added support for dns-search and fixes #30102
Signed-off-by: msabansal <sabansal@microsoft.com>
2017-01-13 12:01:10 -08:00
Kenfe-Mickael Laventure
c178700a04 Remove timeout on fifos opening
Instead of a timeout the context is cancelled on error to ensure
proper cleanup of the associated fifos' goroutines.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-01-13 11:46:48 -08:00
Aaron.L.Xu
39a24019e3 fix typo in libcontainerd/client.go
Signed-off-by: Aaron.L.Xu <likexu@harmonycloud.cn>
2017-01-11 23:10:02 +08:00
Sebastiaan van Stijn
b9ee31ae02 Merge pull request #29314 from vdemeester/no-more-utils
Remove the utils package
2016-12-22 15:21:05 +01:00
lixiaobing10051267
f385846d6f fix some typos in libcontainer\types_windows.go
Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>
2016-12-14 16:33:03 +08:00
Vincent Demeester
8c1ac81665
Move process functions to pkg/system
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-12-12 09:28:41 +01:00
Lei Jitang
267422e4d0 Fix docker restart panic on machine ungracefully shutdown
Machine ungracefully shutdown leaves a lot of container has a
Running=true state.

```
$ cat config.v2.json | jq .

    "Running": true,
    "Paused": false,
    "Restarting": false,

```

And the next docker start will fail with panic.

```

time="2016-12-01T01:54:45.086446715-05:00" level=warning msg="libcontainerd: client is out of sync, restore was called on a fully synced container (49f41ad5ca0be860622d9190673b5816d012022fb2c1794560ec4851e7cfec6a)."
time="2016-12-01T01:54:45.087046004-05:00" level=warning msg="libcontainerd: failed to retrieve container 49f41ad5ca0be860622d9190673b5816d012022fb2c1794560ec4851e7cfec6a state: rpc error: code = 2 desc = containerd: container not found"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x5db7f3]

goroutine 57 [running]:
panic(0x16a8e60, 0xc420010130)
        /usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/docker/docker/libcontainerd.(*client).Restore(0xc4202e1a40, 0xc420415000, 0x40, 0xc42015a0b0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /go/src/github.com/docker/docker/libcontainerd/client_linux.go:457 +0x553
github.com/docker/docker/daemon.(*Daemon).restore.func1(0xc4201c46f0, 0xc4202581e0, 0xc4201c46e8, 0xc42047bfb0, 0xc42047bf80, 0xc42047bf50, 0xc42024ba10, 0xc420512c00)
        /go/src/github.com/docker/docker/daemon/daemon.go:205 +0x198
created by github.com/docker/docker/daemon.(*Daemon).restore
        /go/src/github.com/docker/docker/daemon/daemon.go:260 +0x7bb

```

Signed-off-by: Lei Jitang <leijitang@huawei.com>
2016-12-01 02:25:24 -05:00
Kenfe-Mickael Laventure
9fff9bb761 Fix race with containerd events stream on restore
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-11-30 10:15:39 -08:00
Lei Jitang
9aedaf5b3a Ignore "failed to close stdin" if container or process not found
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2016-11-29 20:41:39 -05:00
Tonis Tiigi
4e262f6387 Fix race on sending stdin close event
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-11-21 17:43:01 -08:00
Darren Stahl
8b50324273 Shutdown instead of terminate process on Windows
Signed-off-by: Darren Stahl <darst@microsoft.com>
2016-11-18 12:05:08 -08:00
Akshay Karle
2d08a76421 fix a typo
Signed-off-by: Akshay Karle <akshay.a.karle@gmail.com>
2016-11-17 16:51:37 -05:00
Victor Vieux
0427afa409 Merge pull request #27955 from mlaventure/runc-docker-info
Add external binaries version to docker info
2016-11-10 21:27:14 -08:00
Darren Stahl
0ed00b36ff Adding more strict resource checks on Windows
Signed-off-by: Darren Stahl <darst@microsoft.com>
2016-11-09 16:29:54 -08:00
Victor Vieux
f67d4b897a Merge pull request #28184 from Microsoft/jjh/user
Windows: Plumb through user
2016-11-09 11:32:42 -08:00
Kenfe-Mickael Laventure
2790ac68b3 Add expected 3rd party binaries commit ids to info
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-11-09 07:42:44 -08:00
Darren Stahl
ae35c0f70e Stop returning errors that should be ignored while closing stdin
Signed-off-by: Darren Stahl <darst@microsoft.com>
2016-11-08 18:25:43 -08:00
John Howard
5207ff7202 Windows: Plumb through user
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-11-08 17:41:56 -08:00
Tonis Tiigi
ee9d28bd3f Don’t warn on missing fifo
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-11-08 09:59:49 -08:00
Amit Krishnan
934328d8ea Add functional support for Docker sub commands on Solaris
Signed-off-by: Amit Krishnan <krish.amit@gmail.com>

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-11-07 09:06:34 -08:00
Darren Stahl
4e15420b9b Windows: Add cpu count option
Signed-off-by: Darren Stahl <darst@microsoft.com>
2016-11-04 13:38:50 -07:00
Yanqiang Miao
1ad989559f Clean up the constants in 'libcontainerd' that are no longer in use
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>

update

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2016-10-28 13:39:04 +08:00
Tonis Tiigi
aa01ee4ac5 Fix logging formatting
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-10-25 18:34:35 -07:00
Tonis Tiigi
37a3be2449 Move stdio attach from libcontainerd backend to callback
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-10-24 00:20:36 -07:00
Tonis Tiigi
6f2658fb8c Refactor stdin closing
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-10-20 17:10:15 -07:00
Tonis Tiigi
6d26464502 Fix issues with fifos blocking on open
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-10-20 17:02:02 -07:00
Antonio Murdaca
1808348136
record pid of exec'd process
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-10-20 17:06:11 +02:00
Jonh Wendell
e03bf1221e Exec: Add ability to set environment variables
Keeping the current behavior for exec, i.e., inheriting
variables from main process. New variables will be added
to current ones. If there's already a variable with that
name it will be overwritten.

Example of usage: docker exec -it -e TERM=vt100 <container> top

Closes #24355.

Signed-off-by: Jonh Wendell <jonh.wendell@redhat.com>
2016-10-19 12:39:25 -02:00
Sebastiaan van Stijn
dd383898cd Merge pull request #26795 from darrenstahlmsft/PauseResume
Implement Pause Resume support for Windows
2016-10-13 18:08:11 -07:00
John Howard
e736b9a172 Merge pull request #27310 from swernli/servicing-error-reporting
Fixing error reporting on servicing failure
2016-10-12 08:47:54 -07:00
Stefan J. Wernli
f65647463e Fixing error reporting on servicing failure
The code that handles waiting for the servicing container to complete correctly grabs the exit code and logs a failure, but doesn't return that failure to the caller, mistakenly causing servicing operations to look successful when they really failed during processing.

Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
2016-10-11 17:11:56 -07:00
Darren Stahl
69985e85d3 Implement Pause Resume support for Windows
Signed-off-by: Darren Stahl <darst@microsoft.com>
2016-10-11 16:23:35 -07:00
Justin Cormack
d316e172da Merge pull request #26690 from mwhudson/ignore-oom_score_adj-failure
Ignore failure to set oom_score_adj, as happens in an unprivileged container.
2016-10-11 10:01:22 +01:00
Tonis Tiigi
606a245d85 Remove restartmanager from libcontainerd
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-10-07 12:09:54 -07:00
Vincent Demeester
b3cc3d7bf9 Merge pull request #23389 from Microsoft/jjh/credentialspec
Windows: Support credential specs
2016-10-07 18:32:44 +02:00
John Howard
e85867cb68 Windows: Support credential specs
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-10-06 09:32:22 -07:00
Darren Stahl
267c04aa36 Revendor hcsshim to v0.5.1
Signed-off-by: Darren Stahl <darst@microsoft.com>
2016-10-05 14:40:51 -07:00
Alexander Morozov
33ae7d4c19 Merge pull request #27149 from swernli/servicing_fix
Fixing servicing bug by always specifying LayerFolderPath
2016-10-05 13:21:47 -07:00
Michael Crosby
214b70e6ef Merge pull request #27038 from jstarks/non_base_utilityvm
Windows: support Windows servicing layers
2016-10-05 10:02:31 -07:00
Brian Goff
c48317ad7c Merge pull request #27152 from darrenstahlmsft/Rounding
Windows: fix rounding error in container resources
2016-10-04 21:08:14 -04:00
Stefan J. Wernli
78540d0d18 Fixing servicing bug by always specifying LayerFolderPath
During the recent OCI changes, I mistakenly thought LayerFolderPath is only needed for Windows Server containers (isolation=process) and not for Hyper-V Containers, but it turns out it is also required for servicing containers used to finish installing updates.  Since the servicing containers need to reuse the container's create options, this change makes it so that LayerFolderPath is always filled in for all containers as part of constructing the create options.

Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
2016-10-04 15:29:30 -07:00
Darren Stahl
1b48203f17 Windows: fix rounding error in container resources
Signed-off-by: Darren Stahl <darst@microsoft.com>
2016-10-04 14:11:32 -07:00
allencloud
5143be0ccf add lock in libcontainerd client AddProcess of Windows
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-10-04 10:29:21 +08:00
allencloud
278273bc16 add lock in libcontainerd client AddProcess
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-10-02 00:36:25 +08:00
John Starks
2a765279fa Windows: Use the top-most utility VM image
Microsoft will be distributing non-base layers that have utility VM image
updates. Update libcontainerd to use the top-most utility VM image that is
available in the image chain when launching Hyper-V-isolated container.

Signed-off-by: John Starks <jostarks@microsoft.com>
2016-09-29 10:49:02 -07:00
John Howard
02309170a5 Remove hacked Windows OCI spec, compile fixups
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-27 12:07:35 -07:00
Victor Vieux
f67096c20b Merge pull request #26744 from LK4D4/attach_before_start
libcontainerd: attach streams before create
2016-09-26 13:08:05 -07:00
msabansal
d1e0a78614 Changes required to support windows service discovery
Signed-off-by: msabansal <sabansal@microsoft.com>
2016-09-22 12:21:21 -07:00
John Howard
dc8631ea53 Merge pull request #26677 from Microsoft/jjh/networkendpointlist
Windows OCI: Remove endpoint list
2016-09-22 11:36:25 -07:00
Sebastiaan van Stijn
221d4fca0c Merge pull request #26796 from Microsoft/jjh/race-lcd-si
Windows: Data race in libcontainerd (si)
2016-09-22 19:44:17 +02:00
John Howard
410a8612f4 Windows OCI: Remove endpoint list
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-22 10:08:13 -07:00
Michael Crosby
3990f28162 Merge pull request #26746 from Microsoft/jjh/hvruntime
Windows: OCI HVRuntime and LayerPaths to options
2016-09-22 09:55:58 -07:00
John Howard
c2499dff64 Windows: Data race in libcontainerd (si)
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-21 14:36:51 -07:00
Alexander Morozov
02d1934279 libcontainerd: attach streams before create
Fix #26371

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-09-21 09:16:12 -07:00
Michael Hudson-Doyle
9ed54d3c67 add log messages when write to oom_score_adj fails
Signed-off-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
2016-09-21 19:36:36 +12:00
Darren Stahl
f6d5f7b975 Revert the fix to invalid handles due to a platform bug
Signed-off-by: Darren Stahl <darst@microsoft.com>
2016-09-20 17:31:24 -07:00
Vincent Demeester
758a809f54 Merge pull request #26538 from LK4D4/update_grpc
Update grpc to v1.0.1-GA
2016-09-20 23:19:26 +02:00
John Howard
a3aceeac50 Windows: OCI HVRuntime and LayerPaths to options
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-20 13:51:53 -07:00
Tõnis Tiigi
511fd49402 Merge pull request #26641 from Microsoft/jjh/aggressivenamespacing
Windows: OCI aggressive namespacing
2016-09-20 13:37:41 -07:00
John Howard
4348878242 Merge pull request #25849 from darrenstahlmsft/LibcontainerdRaces
Lock all calls to hcsshim to prevent close races
2016-09-20 10:34:54 -07:00
Alexander Morozov
5fb3832432 libcontainerd: do not use failfast for events stream
New grpc uses failfast by default, but that code was written with other
default in mind, so just preserve it for now.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-09-20 09:24:40 -07:00
John Howard
bbbc720620 Oops, break should have been continue
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-19 14:41:27 -07:00
Sebastiaan van Stijn
8c508ef813 Merge pull request #26579 from Microsoft/jjh/ociprocess
Windows: OCI `process` struct and console size to uint
2016-09-19 22:52:16 +02:00
Darren Stahl
740e26f384 Lock all calls to hcsshim to prevent close races
Signed-off-by: Darren Stahl <darst@microsoft.com>
2016-09-19 12:59:02 -07:00
Brian Goff
b7e189ed1f Merge pull request #26640 from Microsoft/jjh/removeosversion
Windows: Remove osversion from OCI
2016-09-19 15:42:34 -04:00
John Howard
53774423ff Windows: OCI process struct convergence
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-19 10:34:31 -07:00
John Howard
c89db6c044 Windows: OCI aggressive namespacing
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-19 10:23:11 -07:00
Kenfe-Mickaël Laventure
3fd3d28f5f Merge pull request #26505 from Microsoft/jjh/ocistep1
Windows OCI convergence step 1
2016-09-19 10:23:11 -07:00
John Howard
72de562943 Windows: Remove osversion from OCI
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-19 10:16:15 -07:00
Tõnis Tiigi
b72c7f74a6 Merge pull request #26577 from Microsoft/jjh/fstabmount
Windows: Move to fstab options as per OCI
2016-09-19 10:13:46 -07:00
Akihiro Suda
69f00a137c Fix a race in libcontainerd/pausemonitor_linux.go
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-09-19 07:42:21 +00:00
Michael Hudson-Doyle
32f24bc3c5 Ignore failure to set oom_score_adj, as happens in an unprivileged container.
Signed-off-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
2016-09-19 14:27:10 +12:00
Brian Goff
bc60f5af84 Merge pull request #26650 from Microsoft/jjh/firststart
Windows: OCI remove first start
2016-09-18 09:27:10 -04:00
Brian Goff
112ba3637d Merge pull request #26578 from Microsoft/jjh/ociuser
Windows: Unify OCI user struct
2016-09-18 09:20:45 -04:00
John Howard
f7fd408ba7 Windows: OCI remove first start
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-16 16:05:55 -07:00
John Howard
340e5233b2 Windows: stats support
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-16 11:56:15 -07:00
John Howard
bb585b9c10 Windows: Move to fstab options as per OCI
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-15 10:12:20 -07:00
John Howard
93f61b85eb Windows: Unify OCI user struct
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-15 09:59:27 -07:00
John Howard
7c7c3d7746 Windows OCI convergence step 1
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-12 16:11:47 -07:00
Alexander Morozov
e4ddcb37c1 libcontainerd: use healthcheck to track containerd conn
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-09-12 14:22:38 -07:00
boucher
d8fef66b03 Initial implementation of containerd Checkpoint API.
Signed-off-by: boucher <rboucher@gmail.com>
2016-09-08 21:31:52 -04:00
Brian Goff
4219c0018f Merge pull request #25777 from swernli/servicing_race
Fixing race in Windows container servicing
2016-09-08 10:42:15 -04:00
John Howard
52f0474851 Windows: docker top implementation
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-07 16:29:02 -07:00
Matt Richardson
bc8eabce25 Allow windows environment variables to contain =
Fix issue where environment variables with embedded equals signs were
being dropped and not passed to the container.

Fixes #26178.

Signed-off-by: Matt Richardson <matt.richardson@octopus.com>
2016-09-05 08:49:07 +10:00
allencloud
52637848a7 correct some nits in comment and test files
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-08-29 18:37:14 +08:00
John Howard
d56c2ea9ed Fix minor typo
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-08-17 16:10:01 -07:00
Michael Crosby
041e5a21dc Replace old oci specs import with runtime-specs
Fixes #25804

The upstream repo changed the import paths.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-08-17 09:38:34 -07:00
Darren Stahl
c58d0358c3 Revendor hcsshim
Signed-off-by: Darren Stahl <darst@microsoft.com>
2016-08-16 17:28:49 -07:00
Stefan J. Wernli
6591a37aaf Fixing race in Windows container servicing
There exists a race in container servicing on Windows where, during normal operation, the container will begin to shut itself down while docker calls shutdown explicitly.  If the former succeeds just as the latter is attempting to communicate with the container to request the shutdown, an error comes back that can cause the servicing to incorrectly register as a failure.  Instead, we just wait for the servicing container to shutdown on it's own, using a reasonable timeout to allow for merging in the updates.

Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
2016-08-15 14:32:50 -07:00
Sebastiaan van Stijn
92ef3f615a Merge pull request #25505 from darrenstahlmsft/SignalProcessNewAPI
Changed SignalProcess to use new hcsshim API
2016-08-11 23:21:31 +02:00
Alexander Morozov
64605d709f Merge pull request #23951 from allencloud/defer-os-file-close
add defer file.Close to avoid potential fd leak
2016-08-10 11:07:15 -07:00
allencloud
0ead624473 add defer file.Close to avoid potential fd leak
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-08-10 08:36:09 +08:00
Sebastiaan van Stijn
04e021d751 Merge pull request #23391 from Microsoft/WindowsSandboxSize
Windows: Added support for storage-opt size
2016-08-09 15:34:39 +02:00
Darren Stahl
5eaf86c6db Changed SignalProcess to use new hcsshim API
Signed-off-by: Darren Stahl <darst@microsoft.com>
2016-08-08 14:03:12 -07:00
Tõnis Tiigi
6401bd65b1 Merge pull request #25072 from mlaventure/oos-libcontainerd-client
Handle out-of-sync libcontainerd client on restore
2016-08-05 14:23:25 -07:00
Tonis Tiigi
9be0fb45c2 libcontainerd: mark container exited after failed restart
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-08-03 17:44:30 -07:00
Tonis Tiigi
495448b290 libcontainerd: wait for restart after state change
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-08-03 15:28:07 -07:00
Kenfe-Mickael Laventure
51f21a1674 Handle out-of-sync libcontainerd client on restore
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-07-28 11:26:07 -07:00
Michael Crosby
2650b1b6ab Check if the container is running if no event
When there is no event for the container it can happen because of a
crash and the container state on the persistent disk will have a
mismatch between what was in `/run` ( machine crash ).

This situation will create an unkillable container in docker because
containerd does not see it and it is not running but docker thinks it is
and you cannot tell it anything different.

This fixes the issue by checking if containerd has the container running
if we do not have an event instead of just returning.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-07-28 11:17:02 -07:00
Lei Jitang
c75de8e33c Fix daemon panic on restoring containers
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2016-07-26 22:52:52 -04:00
Kenfe-Mickael Laventure
ac068a1f9d Fix missing unlock in libcontainerd.Restore()
This was preventing the "exit" event to be correctly processed during
the restore process without live-restore enabled.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-07-22 15:21:10 -07:00
Kenfe-Mickael Laventure
5231c55346 Prepend libcontainerd log message with "libcontainerd:"
This will make it easier to pinpoint error messages in the daemon
logs.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-07-22 15:20:14 -07:00
Kenfe-Mickael Laventure
c02f82756e Update libcontainerd.AddProcess to accept a context
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-07-19 08:24:39 -07:00
Kenfe-Mickael Laventure
64483c3bda Do not rely on "live" event anymore
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-07-19 08:24:39 -07:00
Kenfe-Mickael Laventure
29b2714580 Vendor in new containerd
This version introduces the following:
 - uses nanosecond timestamps for event
 - ensure events are sent once their effect is "live"

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-07-18 11:44:24 -07:00
Tonis Tiigi
0b2023130e Wait for the reader fifo opening to block
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-07-14 10:14:53 -07:00
Antonio Murdaca
0a96ba8a0f Merge pull request #24593 from mlaventure/fix-libcontainerd-data-race
Fix data race in libcontainerd
2016-07-14 17:27:24 +02:00