Commit Graph

89 Commits

Author SHA1 Message Date
Kris Nova ca2e851d87 Getting FreeBSD Compiling 2017-09-06 06:35:07 +08:00
yangshukui de0e943db4 Fix close a nil chan err
If docker exec to a container, and then kill the runtime's shim process
it will close a nil chan in Supervisor' execExit interface.

Supervisor.exit
            |---> s.delete
            |         |
            |         V
            |     execMap := s.getDeleteExecSyncMap(t.ID) make getExecSyncChannel return nil
            |
            |--->s.execExit
            |         |
            |         V
            |     synCh := s.getExecSyncChannel(t.ID, t.PID)
            |         |
            |         V
            |     close(synCh) close a nil chan make container panic

Signed-off-by: yangshukui <yangshukui@huawei.com>
2017-05-18 19:29:34 +08:00
lichao-mobanche 2b08c55175 add syscall.EPOLL_CLOEXEC
fix the epoll fd leak
2017-05-15 08:55:02 +08:00
Deng Guangxing 6feebe9419 remove container stat dir when no process found in restore
Under some abnormal cases, container state dir exist while pid file not.
containerd restore would print this error to log without handling this,
it will set container state to stopped without removing its state dir.

trying to start the container again will cause error:
`mkdir /var/run/docker/libcontainerd/containerd/xxx: file exists`

Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
2017-05-10 12:08:03 +08:00
Kenfe-Mickael Laventure 793b73880e Update import path to use containerd/containerd instead of docker/docker
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-04-13 11:58:06 -07:00
Kenfe-Mickael Laventure 49ca5b4d6e Ensure state dir is created before starting server
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-03-15 06:59:03 -07:00
Kenfe-Mickael Laventure 88cd02c528 Create exec sync channel on restore
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-02-16 12:04:02 -08:00
Kenfe-Mickaël Laventure c1b96cb03b Merge pull request #410 from sandyskies/v0.2.x
delete state directory after unclean exits
2017-02-02 10:40:01 -08:00
Kenfe-Mickael Laventure 0f1bea59bc Prevent panic if exec process dies before sync channel is created
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-01-26 13:47:48 -08:00
Kenfe-Mickael Laventure 0f90fb100a Fix deadlock in monitor
This deadlock occurs when the oom channel get full as a process gets
added to the Monitor. Since the channel is full the lock monitor will
never be released preventing the task trying to add a new process to
the monitor to ever complete.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-01-17 07:41:10 -08:00
sandyskies 246cde09d7 fix misspelling
Signed-off-by: sandyskies <chenmingjie0828@163.com>
2017-01-11 21:48:58 +08:00
sandyskies 374210a88b delete state directory after unclean exits
Signed-off-by: sandyskies <chenmingjie0828@163.com>
2017-01-11 21:33:50 +08:00
Lei Jitang d59314b9a8 Fix exec old running container with live-restore
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2016-11-16 08:40:40 +00:00
Kenfe-Mickael Laventure 307cfeca36 Sync exit events
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-11-03 10:23:08 -07:00
Michael Crosby 7f6fe43e6b Merge pull request #335 from mlaventure/json-compat-master
master: Update readEventLogs to support old Event format
2016-10-31 11:25:58 -07:00
Kenfe-Mickael Laventure 034682e4db Honor context termination on Start and Exec
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-10-31 10:12:25 -07:00
Kenfe-Mickael Laventure 1263f28f8c Update readEventLogs to support old Event format
Previously Status was stored as an `int` and could possibly be set to `-1`.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-10-24 11:50:43 -07:00
Amit Krishnan 897874e76d Add support for containerd,containerd-shim and ctr for Solaris. This adds support for ctr containers list,start,stop,kill via a Solaris specific oci compliant runtime.
Signed-off-by: Amit Krishnan <krish.amit@gmail.com>
2016-10-17 14:43:57 -07:00
Antonio Murdaca 35f313d114
api.proto: expose real pids when adding processes
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-10-15 01:23:24 +02:00
Kenfe-Mickael Laventure db9aed5a97 Use uint32 as Event's Status type everywhere
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-09-19 12:01:34 -07:00
Kenfe-Mickael Laventure 920a9c21d7 Don't hog task queue while waiting for exec process
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-09-16 13:30:16 -07:00
Phil Estes 8508d2bec9 Don't call runc start when restoring a checkpoint (#302)
The create/start split left checkpoint/restore broken in that the create
side was calling runc restore, which fully restores the process to
operation, leaving a call to `runc start` as an error (process already
started). This patch skips process.Start as it is an unnecessary (and
wrong) step for a restored checkpoint.

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2016-08-26 10:25:19 -07:00
Kenfe-Mickaël Laventure 0ac3cd1be1 Fix shim deadlock when joining an existing pid namespace (#290)
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-07-15 11:49:43 -07:00
Kenfe-Mickaël Laventure 90f827ca10 Streamline events (#287)
* Sync process.State() with the matching events

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>

* Allow requesting events for a specific container

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>

* Sync container state retrieval with other events

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>

* Let containerd take care of calling runtime delete on exit

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>

* Take care of possible race in TestBusyboxTopExecTopKillInit

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-07-13 11:01:07 -07:00
Lei Jitang 0b15e03da0 set default shim if shim is nil for backward compatibility
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2016-07-05 09:14:20 -04:00
Kenfe-Mickael Laventure d8b9559d8e Handle case where shim is reaped before the call to the runtime start
This avoid erroring out with a false positive

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-07-01 11:26:20 -07:00
Michael Crosby 654c537d38 Call start in containerd
This fixes a sync issue when the containerd api returns after a
container has started.  It fixes it by calling the runtime start inside
containerd after the oom handler has been setup.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-06-27 10:49:20 -07:00
Julio Montes 0227e9fb94 Micro Benchmarks: multiples runtimes (#268)
* Micro benchmarks: use container.Runtime to kill container

Signed-off-by: Julio Montes <julio.montes@intel.com>

* Micro benchmarks: add support for multiples runtimes

Signed-off-by: Julio Montes <julio.montes@intel.com>
2016-06-16 14:39:19 -07:00
Kenfe-Mickaël Laventure 8040df4e89 New oom sync (#257)
* Vendor in runc afaa21f79ade3b2e99a68f3f15e7219155aa4662

This updates the Dockerfile to use go 1.6.2 and install pkg-config are
both are now needed by runc.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>

* Add support for runc create/start operation

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>

* Remove dependency on runc state directory for OOM handler

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>

* Add OOM test

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-06-09 13:33:26 -07:00
Kenfe-Mickaël Laventure 5624732128 Add golint to test (#255)
* Add a new lint rule to the Makefile

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>

* Fix linter errors

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>

* Allow replacing the default apt mirror

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-06-03 15:00:49 -07:00
Ross Boucher e756ae42d1 Add support for specifying a checkpoint directory. (#245)
Signed-off-by: Ross Boucher <rboucher@gmail.com>
2016-05-25 17:42:37 -07:00
Sebastiaan van Stijn d191f5bd1e
fix typo in error-message
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-05-25 13:26:20 +02:00
Kenfe-Mickaël Laventure 126e5c403e Allow specifying runtime to be used when creating container (#247)
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-05-23 15:43:47 -07:00
Amit Krishnan 62e1370f91 containerd build clean on Solaris (#203)
* containerd build clean on Solaris

Signed-off-by: Amit Krishnan <krish.amit@gmail.com>

* Vendor golang.org/x/sys

Signed-off-by: Amit Krishnan <krish.amit@gmail.com>
2016-05-19 10:12:50 -07:00
Kenfe-Mickael Laventure 7979ac24fe Fix restore to correctly set the exec timeout value (containerd)
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-05-02 14:04:14 -07:00
Michael Crosby 847690583f Remove sigchld reaper from containerd process
Because we are launching alot of different runc commands to do
operations there is a race between doing a `cmd.Wait()` and getting the
sigchld and reaping it.  We can remove the sigchild reaper from
containerd as long as we make sure we reap the shim process if we are
the parent, i.e. not restored.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-04-27 16:02:03 -07:00
Michael Crosby f7f4d8677f Remove windows code and simplify linux
Windows will not use containerd and its just unused code and unneed
complexity to keep it all around.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-04-26 14:10:41 -07:00
Michael Crosby 31270bba69 Remove windows files
Windows is not going to use containerd because there is already a
similar implementation on windows.  This removes all the windows files
because there is no reason to keep this overhead when its not going to
be used.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-04-26 14:10:33 -07:00
Michael Crosby c44f03a1bf Merge pull request #215 from HuKeping/runtime_status
Bugfix: ctr container list can not get the proper status of container
2016-04-26 13:43:47 -07:00
HuKeping 40d42a1aac Rework function getContainers
- Use canonical way to check if a map contains a key.
- Use "ci" to keep consistence since it is for "containerInfo".

Signed-off-by: Hu Keping <hukeping@huawei.com>
2016-04-22 17:32:41 -04:00
Michael Crosby c0295fac04 Merge pull request #210 from WeiZhang555/event-types-constant
Move event types constants into single file
2016-04-21 10:24:54 -07:00
Michael Crosby 1b8cc65462 Set fixed event log size
Truncate the event log on disk and in memory so that it does not
grow forever.  This is mainly used for higher levels to receive past
events if they miss any.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-04-20 15:07:49 -07:00
Kenfe-Mickaël Laventure b31b8a611e Merge pull request #157 from mYmNeo/binary-path
let user to specify the shim name or path
2016-04-21 00:31:14 +10:00
Zhang Wei e213e2eb62 Move event types constants into single file
Move all constants for event types to types.go for easier code
readability and maintainance.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-04-19 19:09:54 +08:00
Michael Crosby 4ae5413ed7 Truncate events log after read
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-04-15 13:48:02 -07:00
Michael Crosby 28f9453fbb Error oom if container has not stopped
The oom control file may not exist if the container is short lived and
exits before we can open it.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-04-07 10:44:36 -07:00
Michael Crosby d34c458529 Merge pull request #186 from coolljt0725/arm64_epoll
move epoll syscall to arch specific to enable containerd run on arm64
2016-04-06 17:19:22 -07:00
mYmNeo 4eb27a5926 let user to specify the shim name or path
Signed-off-by: mYmNeo <thomassong@tencent.com>
2016-04-06 14:42:47 +08:00
Lei Jitang 6299489d03 move epoll syscall to arch specific to enable containerd run on arm64
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2016-04-05 23:17:30 -04:00
Michael Crosby 3742ae3ec8 Add timeout flag for container start times
This currently depends on a runc PR:

https://github.com/opencontainers/runc/pull/703

We need this pr because we have to SIGKILL runc and the container root
dir will still be left around.

As for the containerd changes this adds a flag to containerd so that you
can configure the timeout without any more code changes.  It also adds
better handling in the error cases and will kill the containerd-shim and
runc ( as well as the user process if it exists ) if the timeout is hit.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-04-05 13:38:49 -07:00