Commit Graph

273 Commits

Author SHA1 Message Date
Michael Crosby
95d4f53fbe Delete task on dead shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-02-06 12:46:06 -05:00
Michael Crosby
87d15a5ffc Set OnClose shim function
When restoring a task make sure that dead shims are handled.

Fixes #2078

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-02-06 10:45:50 -05:00
Michael Crosby
8ee29a17e6 Bump gc threshold to 40%
Doing tests, this is a better balance for the threshold in reguards to
memory and cpu usage.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-02-02 11:00:34 -05:00
Michael Crosby
ea00fc793b Remove protobuf for mount in shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-02-01 17:18:40 -05:00
Michael Crosby
d179c61231 Revert "Use jsoniteer for faster json encoding/decoding"
This reverts commit 4233b87b89.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-01-29 15:47:48 -05:00
Michael Crosby
4233b87b89 Use jsoniteer for faster json encoding/decoding
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-01-26 16:32:55 -05:00
Phil Estes
d7efcbc083
Merge pull request #2036 from stevvooe/use-buffer-pools
archive, cio, cmd, linux: use buffer pools
2018-01-23 15:00:41 -05:00
Stephen J Day
cd72819b53
archive, cio, cmd, linux: use buffer pools
To avoid buffer bloat in long running processes, we try to use buffer
pools where possible. This is meant to address shim memory usage issues,
but may not be the root cause.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2018-01-22 13:52:06 -08:00
Michael Crosby
2a730264aa Add Exec to process states
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-01-18 17:05:15 -05:00
Michael Crosby
90553efdef
Merge pull request #1989 from crosbymichael/reaper
Remove reaper from containerd daemon
2018-01-10 18:10:15 -05:00
Stephen J Day
c80ca4f4a2
services/tasks, linux: ignore shutdown tasks
Because tasks may be deleted while listing containers, we need to ignore
errors from state requests that are due to a closed error. All of these
get mapped to ErrNotFound, which can be used to filter the entries.

There may be a better fix that does a better job of keeping track of the
intended state of a backend task. The current condition of assuming that
a closed client is a shutdown task may be too naive.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2018-01-10 11:45:33 -08:00
Michael Crosby
9f5182f394 Remove reaper from containerd daemon
This allows other packages and plugins to easily exec things without
racing with the reaper.

The reaper is mostly needed in the shim but can be removed in containerd
in favor of the `exec.Cmd` apis

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-01-10 11:51:58 -05:00
Michael Crosby
2b29a92a64 Hold shim lock during state
Helps with #1935

This hold the shim lock during the state call to make sure that the task
does not get deleted during a state call.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-01-05 11:13:47 -05:00
Michael Crosby
c6b8e57bad Only lock on map get for process state
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-12-21 13:03:51 -05:00
Michael Crosby
8e598fcb21 Check that process exists before it is returned
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-12-21 13:03:51 -05:00
Michael Crosby
f78bad2cc7 Remove panic from newCommand
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-12-06 14:02:24 -05:00
Stephen J Day
c5fe021d5e
api: lock down 1.0 API descriptors
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-12-05 13:17:08 -08:00
Michael Crosby
b0ca685874 Retry unmount on EBUSY and return errors
This is another WIP to fix #1785.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-12-04 11:31:08 -05:00
Michael Crosby
fd2e3cd326 Remove mount namespace from shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-12-01 17:35:14 -05:00
Michael Crosby
74b3cb3391 Fix exit event handling in shim
Could issues where when exec processes fail the wait block is not
released.

Second, you could not dump stacks if the reaper loop locks up.

Third, the publisher was not waiting on the correct pid.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-28 14:32:06 -05:00
Stephen J Day
e8f52c35ce
linux/shim: reduce memory overhead by using ttrpc
By replacing grpc with ttrpc, we can reduce total memory runtime
requirements and binary size. With minimal code changes, the shim can
now be controlled by the much lightweight protocol, reducing the total
memory required per container.

When reviewing this change, take particular notice of the generated shim
code.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-22 12:21:48 -08:00
Michael Crosby
e830112efd Add lock around task cgroup
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-22 11:14:08 -05:00
Daniel Nephin
f74862a0dd Add structcheck, unused, and varcheck linters.
Warn on unused and dead code

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-21 11:14:37 -05:00
Michael Crosby
67232e93dc
Merge pull request #1779 from AkihiroSuda/resolve-util-bin
shim: support non-default binary name
2017-11-17 17:53:43 -05:00
Akihiro Suda
7ef4aa5c25 shim: support non-default binary name
The binary name used for executing "containerd publish" was hard-coded
in the shim code, and hence it did not work with customized daemon
binary name. (e.g. `docker-containerd`)

This commit allows specifying custom daemon binary via `containerd-shim
-containerd-binary ...`.
The daemon invokes this command with `os.Executable()` path.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-11-17 22:21:54 +00:00
Stephen J Day
50532f231a
api: use weak imports for plugin protobufs
Because of a side-effect import, we have the possibility of pulling in
several unnecessary packages that are used by the plugin and not at
runtime to implement protobuf structures. Setting these imports to
`weak` prevents this from happening, reducing the total import set,
reducing memory usage and binary size.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-16 20:18:15 -08:00
Derek McGowan
5c6e789dde
Merge pull request #1769 from stevvooe/split-events-types
api/events: split event types from events service
2017-11-16 16:29:28 -08:00
Stephen J Day
09b5ca1072
api/events: split event types from events service
To avoid importing all of grpc when consuming events, the types of
events have been split in to a separate package. This should allow a
reduction in memory usage in cases where a package is consuming events
but not using the gprc service directly.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-16 15:20:46 -08:00
Stephen J Day
c5022ad92d
protobuf: use the gogo/types package for empty
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-15 19:08:54 -08:00
Michael Crosby
8376b50b19 Add grpc methods to errdefs
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-13 16:45:25 -05:00
Michael Crosby
c81788b129 Remove errdefs and shimapi types from proc package
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-13 16:45:25 -05:00
Michael Crosby
9abde39bf7 Fix lint issues on init process
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-13 16:45:25 -05:00
Michael Crosby
66a70e7fda Refactor runtime initialization
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-13 16:45:25 -05:00
Michael Crosby
36e5548e76 Remove namepsaces and id imports from shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-13 16:45:25 -05:00
Michael Crosby
a7343b0773 Move events from shim into linux runtime
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-13 16:45:25 -05:00
Michael Crosby
1fe5a251c4 Move Exec creation to init process
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-13 16:45:25 -05:00
Michael Crosby
6e25898ff0 Move shim process code to package
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-13 16:45:25 -05:00
Kenfe-Mickael Laventure
231c96098e
containerd-shim: Delete exec pidfile on exit
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-11-13 08:42:25 -08:00
Jess Valarezo
0961807715 rename runcopts to runctypes
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-11-10 11:43:51 -08:00
Jess Valarezo
807f4d2ec7 expose exec-id on ctr task ps
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-11-10 11:38:51 -08:00
Stephen J Day
08d1e72cc0
api,linux,windows: update generated protobufs
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-09 13:37:06 -08:00
Michael Crosby
d01fb047f4 Fix runtime root with no-shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-07 12:12:53 -05:00
Michael Crosby
fc08f019f3 Fix windows compile for dialer package
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-07 10:56:02 -05:00
Michael Crosby
bba473aeb1 Move shim client into subpackage
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-07 10:51:12 -05:00
Michael Crosby
13c7c3ef10 Remove urfave cli dep from shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-07 10:51:12 -05:00
Michael Crosby
a70b95b202 Move events exchange into subpackage
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-07 10:51:12 -05:00
Michael Crosby
5fd0415985 Add comments and fix common lint issues
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-20 13:19:14 -04:00
Kenfe-Mickael Laventure
71f0bb3e3c
linux: Pass correct path to runc when doing a checkpoint
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-10-16 10:45:03 -07:00
Stephen J Day
8508e8252b
plugin: refactor plugin system to support initialization reporting
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-10-10 16:40:47 -07:00
Michael Crosby
12c79cc0d9 Merge pull request #1604 from jessvalarezo/windows-listpids
ListPids returns process details in addition to process IDs.
2017-10-10 19:26:47 -04:00