Commit Graph

466 Commits

Author SHA1 Message Date
Lantao Liu
48b81e872c Do not return error when rootfs already exists.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-05-22 15:57:19 -07:00
Derek McGowan
c9c555cd71
Merge pull request #3226 from Ace-Tang/kill_shim_in_clean
runtime-v1: kill shim in exit handler
2019-05-22 11:56:40 -07:00
Derek McGowan
ec0b722083
Merge pull request #3292 from crosbymichael/shim-cgroup
Add shim cgroup support for v2 runtimes
2019-05-22 10:32:47 -07:00
Derek McGowan
30082abed3
Merge pull request #3293 from crosbymichael/atomic-delete
Improve atomic delete
2019-05-21 13:54:47 -07:00
Michael Crosby
bcb6c8db47
Merge pull request #3279 from mxpv/ttrpc
Add TTRPC client
2019-05-21 12:24:31 -04:00
Maksym Pavlenko
7f79fbb245 Move ttrpc client to pkg/ttrpcutil
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-05-20 16:44:49 -07:00
Ace-Tang
5b7a327c47 Improve atomic delete
skip hidden directories in load task, and return soon if path not exist
in atomicDelete

carry of #3233

Closes #3233

Signed-off-by: Ace-Tang <aceapril@126.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-05-20 20:13:35 +00:00
Michael Crosby
fe6a2b03ed Add shim cgroup support for v2 runtimes
Closes #3198

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-05-20 16:04:06 +00:00
Michael Crosby
90c6c1af43 Pass options on shim create for v2
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-05-17 21:02:23 +00:00
Maksym Pavlenko
7b06c9a1ce Add TTRPC client
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-05-13 21:05:07 -07:00
Justin Terry (VM)
5e962dd8ba Remove unused Resize method from initState
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2019-05-13 12:35:22 -07:00
Li Yuxuan
66036d9206 v1: Respect the shim_debug flag when load tasks
Currently when we restart containerd it will load all tasks with shim
logs whether the `shim_debug` is set or not.

Signed-off-by: Li Yuxuan <liyuxuan04@baidu.com>
2019-05-13 23:51:16 +08:00
Derek McGowan
bc944553a8
Merge pull request #3206 from Random-Liu/cleanup-after-deadshim-v2
Cleanup dead v2 shim.
2019-05-10 11:56:57 -07:00
Michael Crosby
57fbb16234
Merge pull request #3149 from lifubang/pidnamespace
fix killall when use pidnamespace
2019-05-09 14:28:44 -04:00
Li Yuxuan
cf6e008542 Fix fd leak of shim log
Open shim v2 log with the flag `O_RDWR` will cause the `Read()` block
forever even if the pipe has been closed on the shim side. Then the
`io.Copy()` would never return and lead to a fd leak.
Fix typo when closing shim v1 log which causes the `stdouLog` leak.
Update `numPipes` function in test case to get the opened FIFO
correctly.

Signed-off-by: Li Yuxuan <liyuxuan04@baidu.com>
2019-05-09 20:21:57 +08:00
Lantao Liu
660554d671 Fix error handling for task deletion.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-05-07 08:48:54 -07:00
Michael Crosby
5cf1356c5c
Merge pull request #3255 from dvrkps/usecancel
Use cancel on errors
2019-05-07 11:40:35 -04:00
Phil Estes
836cf53e40
Merge pull request #3244 from Random-Liu/fix-container-cleanup
Return NotFound error for kill and delete in deleted state.
2019-05-07 16:49:45 +02:00
Michael Crosby
19af235051
Merge pull request #3148 from masters-of-cats/wip-rootless-containerd
Skip rootfs unmount when no mounts are provided
2019-05-07 10:39:02 -04:00
Lantao Liu
5c9811ded0 Cleanup dead v2 shim.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-04-30 13:45:01 -07:00
Davor Kapsa
38e3696574 Use cancel on errors
Signed-off-by: Davor Kapsa <davor.kapsa@gmail.com>
2019-04-30 21:11:34 +02:00
Justin Terry (VM)
969035bcbd Stop logging error on v2 multi shim log failure
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2019-04-30 11:20:58 -07:00
Sebastiaan van Stijn
8c5779c32b
bump containerd/ttrpc 699c4e40d1e7416e08bf7019c7ce2e9beced4636
full diff: f02858b145...699c4e40d1

- containerd/ttrpc#33 Fix returns error message
- containerd/ttrpc#35 Make onclose an option

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-27 15:30:18 -07:00
Lantao Liu
dff7456804 Return NotFound error for kill and delete in deleted state.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-04-26 15:17:18 -07:00
Erik Sipsma
48f46516ad Support disabling default setup of shim logger.
Before this change, the v2 runtime shim setup code was hardcoded to always
configure logrus to write logs to the "log" FIFO present in the current working
directory. This only happens in the "default" action codepath
(i.e. not shim start or shim delete).

This is problematic for shims that execute outside the current working
directory of a bundle. For example, it often doesn't make sense for shims that
manage multiple containers to execute in a single bundle directory. Additionally,
shim processes that require being pre-created, i.e. spun up before tasks they
will handle are actually created, won't have a log FIFO to write to until a task
is created.

This change leaves the default behavior as is but introduces a Binary Config
field that will optionally disable automatic configuration of logrus to use the
"log" FIFO. This allows shims to configure their own logger if necessary while
still re-using the rest of the shim helper code in containerd.

Signed-off-by: Erik Sipsma <sipsma@amazon.com>
2019-04-24 19:01:12 +00:00
Ace-Tang
dfa51c9279 runtime-v1: kill shim in cleanupAfterDeadShim
1. kill shim in cleanupAfterDeadShim avoid shim leak
2. refactor cleanupAfterDeadShim, get pid from bundle
path instead of make pid as a parameter

Signed-off-by: Ace-Tang <aceapril@126.com>
2019-04-22 14:29:40 +08:00
Phil Estes
4c16017e2f
Merge pull request #3209 from Random-Liu/fix-v1-shim-cleanup
Shim v1: Check task list to avoid unnecessary cleanup.
2019-04-16 15:39:53 -04:00
Michael Crosby
63c7a879b6 Requeue events in the shim publisher
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-04-12 11:57:20 -04:00
Lantao Liu
9cc58781fa Check task list to avoid unnecessary cleanup.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-04-11 16:29:09 -07:00
Michael Crosby
047348e198 Add dialer for events service
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-04-11 12:01:52 -04:00
Michael Crosby
ae87730ad2 Improve shim shutdown logic
Shims no longer call `os.Exit` but close the context on shutdown so that
events and other resources have hit the `defer`s.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-04-10 18:17:07 -04:00
Michael Crosby
4ba756edda Fix API forward events for shims
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-04-10 13:34:34 -04:00
Michael Crosby
a6f587e4c4 Use ttrpc to publish runtime v2 events
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-04-09 14:38:50 -04:00
Lantao Liu
74eb0dc812 Return event publish errors.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-04-04 14:55:38 -07:00
Georgi Sabev
c0f0b21314 Apply PR feedback
* Rootfs dir is created during container creation not during bundle
  creation
* Add support for v2
* UnmountAll is a no-op when the path to unmount (i.e. the rootfs dir)
  does not exist or is invalid

Co-authored-by: Danail Branekov <danailster@gmail.com>
Signed-off-by: Georgi Sabev <georgethebeatle@gmail.com>
2019-04-04 18:40:30 +03:00
Georgi Sabev
2a5e4c4be7 Skip rootfs unmount when no mounts are provided
Co-authored-by: Julia Nedialkova <julianedialkova@hotmail.com>
Signed-off-by: Georgi Sabev <georgethebeatle@gmail.com>
2019-04-04 18:20:09 +03:00
Sebastiaan van Stijn
2d11f5e6d5
Regenerate protobufs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-03 23:41:15 +02:00
Sebastiaan van Stijn
01310eaebc
do not use unkeyed fields in compose literals
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-03 22:20:39 +02:00
Peter Wagner
ae04c16607 runtime: guard Close() until both streams are complete
Signed-off-by: Peter Wagner <thepwagner@github.com>
2019-04-01 15:23:57 -04:00
Peter Wagner
e96ac2040d runtime: log IO error when copying output streams
Signed-off-by: Peter Wagner <thepwagner@github.com>
2019-04-01 15:23:57 -04:00
Lifubang
872296642a fix shouldKillAllOnExit check for v2
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2019-03-30 11:37:14 +08:00
Lifubang
fa5f744a79 fix shouldKillAllOnExit check
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2019-03-30 11:36:56 +08:00
Michael Crosby
ef45e4f021
Merge pull request #3046 from linxiulei/fix_shim_socket
Shorten the unix socket path for shim
2019-03-15 09:10:47 -05:00
Eric Lin
a631796fda horten the unix socket path for shim
Use sha256 hash to shorten the unix socket path to satisfy the
length limitation of abstract socket path

This commit also backports the feature storing address path to
a file from v2 to keep compatibility

Fixes #3032

Signed-off-by: Eric Lin <linxiulei@gmail.com>
2019-03-15 11:58:30 +08:00
Michael Crosby
e6ae9cc64f Shim pluggable logging
Closes #603

This adds logging facilities at the shim level to provide minimal I/O
overhead and pluggable logging options.  Log handling is done within the
shim so that all I/O, cpu, and memory can be charged to the container.

A sample logging driver setting up logging for a container the systemd
journal looks like this:

```go
package main

import (
	"bufio"
	"context"
	"fmt"
	"io"
	"sync"

	"github.com/containerd/containerd/runtime/v2/logging"
	"github.com/coreos/go-systemd/journal"
)

func main() {
	logging.Run(log)
}

func log(ctx context.Context, config *logging.Config, ready func() error) error {
	// construct any log metadata for the container
	vars := map[string]string{
		"SYSLOG_IDENTIFIER": fmt.Sprintf("%s:%s", config.Namespace, config.ID),
	}
	var wg sync.WaitGroup
	wg.Add(2)
	// forward both stdout and stderr to the journal
	go copy(&wg, config.Stdout, journal.PriInfo, vars)
	go copy(&wg, config.Stderr, journal.PriErr, vars)

	// signal that we are ready and setup for the container to be started
	if err := ready(); err != nil {
		return err
	}
	wg.Wait()
	return nil
}

func copy(wg *sync.WaitGroup, r io.Reader, pri journal.Priority, vars map[string]string) {
	defer wg.Done()
	s := bufio.NewScanner(r)
	for s.Scan() {
		if s.Err() != nil {
			return
		}
		journal.Send(s.Text(), pri, vars)
	}
}
```

A `logging` package has been created to assist log developers create
logging plugins for containerd.

This uses a URI based approach for logging drivers that can be expanded
in the future.

Supported URI scheme's are:

* binary
* fifo
* file

You can pass the log url via ctr on the command line:

```bash
> ctr run --rm --runtime io.containerd.runc.v2 --log-uri binary://shim-journald docker.io/library/redis:alpine redis
```

```bash
> journalctl -f -t default:redis

-- Logs begin at Tue 2018-12-11 16:29:51 EST. --
Mar 08 16:08:22 deathstar default:redis[120760]: 1:C 08 Mar 2019 21:08:22.703 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
Mar 08 16:08:22 deathstar default:redis[120760]: 1:M 08 Mar 2019 21:08:22.704 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
Mar 08 16:08:22 deathstar default:redis[120760]: 1:M 08 Mar 2019 21:08:22.704 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
Mar 08 16:08:22 deathstar default:redis[120760]: 1:M 08 Mar 2019 21:08:22.704 # Current maximum open files is 1024. maxclients has been reduced to 992 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
Mar 08 16:08:22 deathstar default:redis[120760]: 1:M 08 Mar 2019 21:08:22.705 * Running mode=standalone, port=6379.
Mar 08 16:08:22 deathstar default:redis[120760]: 1:M 08 Mar 2019 21:08:22.705 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
Mar 08 16:08:22 deathstar default:redis[120760]: 1:M 08 Mar 2019 21:08:22.705 # Server initialized
Mar 08 16:08:22 deathstar default:redis[120760]: 1:M 08 Mar 2019 21:08:22.705 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
Mar 08 16:08:22 deathstar default:redis[120760]: 1:M 08 Mar 2019 21:08:22.705 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
Mar 08 16:08:22 deathstar default:redis[120760]: 1:M 08 Mar 2019 21:08:22.705 * Ready to accept connections
Mar 08 16:08:50 deathstar default:redis[120760]: 1:signal-handler (1552079330) Received SIGINT scheduling shutdown...
Mar 08 16:08:50 deathstar default:redis[120760]: 1:M 08 Mar 2019 21:08:50.405 # User requested shutdown...
Mar 08 16:08:50 deathstar default:redis[120760]: 1:M 08 Mar 2019 21:08:50.406 * Saving the final RDB snapshot before exiting.
Mar 08 16:08:50 deathstar default:redis[120760]: 1:M 08 Mar 2019 21:08:50.452 * DB saved on disk
Mar 08 16:08:50 deathstar default:redis[120760]: 1:M 08 Mar 2019 21:08:50.453 # Redis is now ready to exit, bye bye...
```

The following client side Opts are added:

```go
// LogURI provides the raw logging URI
func LogURI(uri *url.URL) Creator { }
// BinaryIO forwards contianer STDOUT|STDERR directly to a logging binary
func BinaryIO(binary string, args map[string]string) Creator {}
```

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-03-12 12:18:28 -04:00
Justin Terry (VM)
828f6eb842 Fix a bug in shim log on Windows that can cause 100% CPU utilization
With the change to unified shims (ie: 1 shim per multiple tasks) the shimLog
on Windows for the 2nd-Nth worload containers will not have an associated
named pipe listener.

Due to a subtle bug in errors.Wrap passing a nil error we would unblock the
disconnected listener and return 0 byte successfull reads which would cause go
to continually read and cap the CPU.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2019-02-27 16:51:52 -08:00
Michael Crosby
84a24711e8 Add runc.v2 multi-shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-02-21 11:09:46 -05:00
Michael Crosby
6bcbf88f82 Move runc shim code into common package
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-02-21 10:47:41 -05:00
Tonis Tiigi
b553a12be6 runtime: allow specifying supported platforms with config
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-02-20 07:29:23 -08:00
Justin Terry (VM)
b87e9eef3e Add ExecID for StateResponse
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2019-02-13 12:58:50 -08:00
Justin Terry (VM)
a4f7b3758e Add support for TaskDelete event on exec in RuntimeV2
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2019-02-12 15:50:21 -08:00
Kevin Parsons
225d9b120c Fix LCOW layer ordering
Due to an error in the OCI specf for layerFolders, the runhcs shim was
passing the layers for LCOW in reverse order. This fixes the ordering
by simply removing the code which reversed the layers for LCOW.

Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
2019-02-07 17:27:01 -08:00
Michael Crosby
2dacef07ca Add shim skeleton code
This allows runtime authors to quickly bootstrap new shim
implementations.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-02-06 15:03:02 -05:00
Michael Crosby
6b25c1e45c
Merge pull request #2970 from Random-Liu/fix-exec-race-condition
Fix exec race condition
2019-02-01 16:08:41 -05:00
Justin Terry (VM)
dfcc5942f1 Fix deadlock in Windows runhcs shim exec
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2019-02-01 10:58:01 -08:00
Lantao Liu
952d58297d Add a separate lock for pid.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-02-01 08:48:26 -08:00
Lantao Liu
9777d76890 Revert "use state machine management for exec.Pid()"
This reverts commit bbc2a995f9.

Signed-off-by: Lantao Liu <lantaol@google.com>
2019-01-31 18:59:34 -08:00
Justin Terry (VM)
6ed293ba94 Fix bug in shim path lookup
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2019-01-28 14:04:14 -08:00
Justin Terry (VM)
d63099c4a6 Allow matching shim path side by side with containerd
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2019-01-28 12:49:14 -08:00
Justin Terry (VM)
764afa0d18 Include extension for shim binary format on Windows
Use full name including extension for shim binary format on Windows in order to
match any stat path faster without a fallback.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2019-01-28 12:42:08 -08:00
Michael Crosby
85aa8ad361 Move task events to runc v2 shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-01-25 14:15:43 -05:00
Phil Estes
f63d28984c
Merge pull request #2939 from jterry75/bug_publishstart
Implement the Runtime v2 Shim async task model for runhcs
2019-01-25 12:39:48 -05:00
Michael Crosby
f444696989 Return out of windows signal handler
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-01-23 16:06:49 -05:00
Lantao Liu
26ab393e7d Use context.Background for O_NONBLOCK OpenFifo.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-01-23 10:18:54 -08:00
Wei Fu
132ee9b826 fix: linter issue
megacheck, gosimple and unused has been deprecated and subsumed by
staticcheck. And staticcheck also has been upgraded. we need to update
code for the linter issue.

close: #2945

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2019-01-23 22:54:51 +08:00
Michael Crosby
35582cb7a3
Merge pull request #2899 from fuweid/proposal-add-Add-method-in-PlatformRuntime
runtime: add Add/Delete method in PlatformRuntime interface
2019-01-22 13:48:39 -05:00
Justin Terry (VM)
6468619d73 Implement the Runtime v2 Shim async task model for runhcs
Changes the requirement of a Runtime v2 shim in order to avoid race conditions
between shim and shim client sending async events. Places a requirement of what
events and what order a shim must comply to.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2019-01-17 14:56:37 -08:00
John Howard
4ef9bf5c84 Windows: Publish exit status correctly in TaskExit
Signed-off-by: John Howard <jhoward@microsoft.com>

Before this change, the shim was only publishing a non-zero exit status
(exit code) in the case that the process.Wait() call failed. This
grabs the exit status correctly when process.Wait() succeeds too.
2019-01-15 11:12:27 -08:00
Phil Estes
33b56e253e
Merge pull request #2927 from jterry75/bug_io_relay_close
Fix issue in runhcs shim CloseIO
2019-01-15 09:59:09 -05:00
John Howard
e30bba53ff
Merge pull request #2926 from jterry75/bug_argon_mount
Fix runhcs shim bug in Create with "len(Rootfs) == 0"
2019-01-14 15:26:32 -08:00
Justin Terry (VM)
c5a8c9fc12 Fix issue in runhcs shim CloseIO
The call was closing all upstream IO when a shim.CloseIO call was made rather
than just the Stdin as it is supposed to.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2019-01-14 13:31:28 -08:00
Justin Terry (VM)
31616e7945 Fix runhcs shim bug in Create with "len(Rootfs) == 0"
Rootfs length can be set to zero if the upstream caller fully manages storage
and mounts on their own. In this case just treat the bundle as a fully complete
OCI spec and run it without doing any storage work in the shim.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2019-01-14 13:24:15 -08:00
Justin Terry (VM)
bcd4cc51c8 Fixes a bug in runhcs shim Exec.Pid
When an exec occurs the pid was not properly updated on the in memory state
value causing many queries to see a 0.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2019-01-14 13:18:02 -08:00
Michael Crosby
fcf5462d49
Merge pull request #2914 from jterry75/runhcs_runtime_opts
Update runhcs options to include CRI Sandbox support
2019-01-07 11:54:41 -05:00
Justin Terry (VM)
bc76e01a87 Update runhcs options to include CRI Sandbox support
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2019-01-04 14:37:10 -08:00
Justin Terry (VM)
dee0945e18 Fix spurious ttrpc client shutdown error log on success
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2019-01-03 13:44:29 -08:00
Wei Fu
568b5be936 runtime: add Add/Delete method in PlatformRuntime interface
The two new method Add/Delete can allow custom plugin to add or migrate
existing task into major Runtime plugin.

close: #2888

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2018-12-29 13:56:38 +08:00
Phil Estes
47b328aab7
Merge pull request #2897 from crosbymichael/atomic-delete
Ensure bundle removal is atomic
2018-12-21 08:27:43 -05:00
Michael Crosby
36e4dc603e Ensure bundle removal is atomic
This makes bundle removal atomic by first renaming the bundle and
working directories to a hidden path before removing the underlying
directories.

Closes #2567
Closes #2327

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-12-20 13:45:18 -05:00
Phil Estes
06e04bc5a9
Merge pull request #2830 from Ace-Tang/support_cr_without_image
cr: support checkpoint/restore without image
2018-12-20 13:24:37 -05:00
Justin Terry (VM)
0ec6526fd3 Update the delete docs for Runtime V2 on Windows
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-12-17 13:26:57 -08:00
Justin Cormack
8be05eb237
Fix freebsd build
This brings freebsd in line with Darwin, ie it builds, but some parts may not yet
be fully functional. There is now a WIP `runc` port for FreeBSD at
https://github.com/clovertrail/runc/tree/1501-SupportOnFreeBSD so should be able
to test further.

Signed-off-by: Justin Cormack <justin@specialbusservice.com>
2018-12-16 14:27:42 +00:00
Michael Crosby
a2a4241979 Add timeout and cancel to shim fifo open
There is still a special case where the client side fails to open or
load causes things to be slow and the shim can lock up when this
happens.  This adds a timeout to the context for this case to abort fifo
creation.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-12-13 14:43:41 -05:00
Michael Crosby
3ae8e8a30b Add shim config for shim binary options
Fixes #2855

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-12-05 13:14:26 -05:00
Michael Crosby
66c20f2b75 Update runc to 96ec2177ae841256168fcf76954f7177af
This fixes a regression in runc that didn't allow signals being sent to
paused containers.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-12-04 11:21:20 -05:00
Lantao Liu
79499980e4 Kill should still work in stopped state.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-12-03 16:57:20 -08:00
Ace-Tang
6593399e9f cr: support checkpoint/restore without image
support checkpoint without committing a checkpoint dir into a
checkpoint image and restore without untar image into checkpoint
directory. support for both v1 and v2 runtime

Signed-off-by: Ace-Tang <aceapril@126.com>
2018-11-29 10:19:39 +08:00
Phil Estes
9e372ff01d
Merge pull request #2836 from jterry75/exe_search_path
Cache shim v2 exec.LookPath results
2018-11-28 11:51:03 +00:00
Justin Terry (VM)
09bf314bfd Cache shim v2 exec.LookPath results
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-11-27 15:11:04 -08:00
Phil Estes
dcb82064d3
Merge pull request #2826 from lifubang/statemachineforpid
Fixes: shim service event blocked when waiting for IO finished
2018-11-27 15:46:28 -05:00
Michael Crosby
3eae8b9c3f
Merge pull request #2631 from masters-of-cats/shim-io-redirect
Use named pipes for shim logs
2018-11-27 10:44:00 -05:00
Ace-Tang
fd16bf6d46 runtimev2: add image-path and work-path for c/r
add ImagePath and WorkPath for checkpoint process, add CriuImagePath
and CriuWorkPath for create process in runtime v2 protobuf

Signed-off-by: Ace-Tang <aceapril@126.com>
2018-11-24 23:08:25 +08:00
Ace-Tang
83ebcf9992 runtimev1: add image-path and work-path for c/r
add ImagePath and WorkPath for checkpoint process, add CriuImagePath
and CriuWorkPath for create process in runtime v1 protobuf

Signed-off-by: Ace-Tang <aceapril@126.com>
2018-11-24 23:08:25 +08:00
Lifubang
bbc2a995f9 use state machine management for exec.Pid()
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-11-23 17:46:32 +08:00
Phil Estes
181a522142
Merge pull request #2807 from lifubang/shimlockwhenstdinclose
fix pipe in broken may cause shim lock forever
2018-11-20 22:38:22 +08:00
Lantao Liu
7d91d631e0 Lock KillAll.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-11-19 15:19:35 -08:00
Lifubang
e76a8879eb fix pipe in broken may cause shim lock forever for runtime v1
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-11-19 09:25:43 +08:00
Lifubang
b3438f7a6f fix pipe in broken may cause shim lock forever for runtime v2
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-11-19 09:02:49 +08:00
Phil Estes
d8621e258c
Merge pull request #2800 from crosbymichael/revert-dropped
Revert v2 dropped events
2018-11-17 09:01:58 +08:00
Michael Crosby
d48d7464ad
Merge pull request #2773 from crosbymichael/state-locking
Fix process locking and state management
2018-11-16 14:15:04 -05:00
Michael Crosby
956e49a36b Revert v2 dropped events
Partial revert of #2748

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-11-16 11:34:15 -05:00
Julia Nedialkova
1d4105cacf Use named pipes for shim logs
Relating to issue [#2606](https://github.com/containerd/containerd/issues/2606)

Co-authored-by: Oliver Stenbom <ostenbom@pivotal.io>
Co-authored-by: Georgi Sabev <georgethebeatle@gmail.com>
Co-authored-by: Giuseppe Capizzi <gcapizzi@pivotal.io>
Co-authored-by: Danail Branekov <danailster@gmail.com>

Signed-off-by: Oliver Stenbom <ostenbom@pivotal.io>
Signed-off-by: Georgi Sabev <georgethebeatle@gmail.com>
Signed-off-by: Giuseppe Capizzi <gcapizzi@pivotal.io>
Signed-off-by: Danail Branekov <danailster@gmail.com>
2018-11-16 16:11:43 +02:00
Justin Terry (VM)
8e25ca6bf0 Revendor github.com/sirupsen/logrus to v1.0.3
logrus v1.0.3 was the first release that include the change in
terminal_windows.go that stops exec'ing "cmd ver" to obtain the version
information and rather uses the x/sys/crypto/terminal.IsTerminal on the
console fd. On Windows this is a significant performance difference to
avoid the additional process activation of the "cmd ver" for each
invocation of the shim/runhcs executables.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-11-13 09:27:29 -08:00
Michael Crosby
96d30788e1
Merge pull request #2770 from Random-Liu/partial-revert-#2748
Partially revert the event discard change in #2748.
2018-11-09 15:57:33 -05:00
Michael Crosby
831a41b958 Fix process locking and state management
There were races with the way process states.  This displayed in ways,
especially around pausing the container for atomic operations.  Users
would get errors like, cannnot delete container in paused state and
such.

This can be eaisly reproduced with `docker` and the following command:

```bash
> (for i in `seq 1 25`; do id=$(docker create  alpine usleep 50000);docker start $id;docker commit $id;docker wait $id;docker rm $id; done)
```

This two issues that this fixes are:

* locks must be held by the owning process, not the state operations.
* If a container ends up being paused but before the operation
completes, the process exists, make sure we resume the container before
setting the the process as exited.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-11-09 11:40:37 -05:00
Ace-Tang
c4feaa75cf fix: fix failed to get container-shim relation with io.containerd.runc.v1
add '-id' flag when start container with io.containerd.runc.v1 shim, or user
can not get container-shim relation from 'ps -ef',like

```
/usr/bin/containerd-shim-runc-v1 -namespace default -address
/run/containerd/containerd.sock -publish-binary /usr/bin/containerd
```

Signed-off-by: Ace-Tang <aceapril@126.com>
2018-11-09 11:01:35 +08:00
Lantao Liu
c524b9ce41 Partially revert the event discard change in #2748.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-11-08 14:47:32 -08:00
Wei Fu
38d7d59e8a enhance: update v1/v2 runtime
1. avoid dead lock during kill, fetch allProcesses before handle events
2. use argu's ctx instead of context.Backgroud() in openlog

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2018-11-06 22:48:43 +08:00
Justin Terry (VM)
a33ad40245 Implement io.containerd.runhcs.v1 shim log opts
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-11-05 09:08:48 -08:00
Justin Terry (VM)
ec3dbd155e Add io.containerd.runhcs.v1 shim proto options
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-11-05 09:08:48 -08:00
Michael Crosby
232a063496 Increase reaper buffer size and non-blocking send
Fixes #2709

This increases the buffer size for process exit subscribers. It also
implements a non-blocking send on the subscriber channel.  It is better
to drop an exit even than it is to block a shim for one slow subscriber.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-10-29 16:46:58 -04:00
Ace-Tang
c206da7957 optimize shim lock in runtime v1
apply lock only around process map of shim service, avoid lock affect
other procs operations.

Signed-off-by: Ace-Tang <aceapril@126.com>
2018-10-25 15:27:46 +08:00
Ace-Tang
7b1b16b741 runtime-v2: add validation for runtime name
add validation for runtime name, if runtime name is invalid,
containerd will got panic.

Signed-off-by: Ace-Tang <aceapril@126.com>
2018-10-19 15:19:45 +08:00
Wei Fu
accadd7118 fixtypo: misspell in runtime package
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2018-10-18 23:21:05 +08:00
Justin Terry (VM)
3f1d9b2c4f Revendor github.com/Microsoft/hcsshim
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-10-15 13:38:24 -07:00
Justin Terry (VM)
ab2031236a Add blocking buffered writes to shim
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-10-02 11:10:43 -07:00
Justin Terry (VM)
beb1f432be Review fixes
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-10-02 11:10:43 -07:00
Justin Terry (VM)
2ddbb2db05 Handle shim delete workdir on Windows
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-10-02 11:10:43 -07:00
Justin Terry (VM)
b8945d35f5 Decrease shim timeout on pipe not found
On Windows because of the way the log pipe is forwarded to the shim there is a
condition where the pipe listener may not yet be active when a client tries to
connect. To handle this case we allow polling on the file and rety on pipe not
found. This limits the pipe not found retry to 5 seconds but leaves the connect
timeout alone as if there is a listener we want to connect to it normally.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-10-02 11:10:43 -07:00
Justin Terry (VM)
ddbeb3f7c7 Adds Windows shim reconnect logs support
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-10-02 11:10:37 -07:00
Justin Terry (VM)
81eb40fabf Adds containerd-shim-runhcs verbose logging support
Revendors to Microsoft/hcsshim v0.7.5 that added support for logging all
runhcs.exe commands via Windows named pipes. This now launches all runhcs.exe
commands and forwards debug logging to the containerd-shim-runhcs log when
with --debug.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-09-27 07:46:09 -07:00
Justin Terry (VM)
772644e978 Fixes containerd-shim-runhcs State on exec id
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-09-27 07:46:09 -07:00
Justin Terry (VM)
83437ef646 Fixes containerd-shim-runhcs Delete on exec id
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-09-27 07:46:09 -07:00
Justin Terry (VM)
84aa0bfde6 Forward containerd debug to shim invocation
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-09-27 07:46:01 -07:00
Michael Crosby
87d1118a0f
Merge pull request #2605 from lifubang/runafterstart
fix delete running bundle dir when ctr t start a container again
2018-09-21 14:22:33 -04:00
Lifubang
557e8e0b0d fix delete running bundle dir when run t start cmd again
Signed-off-by: Lifubang <lifubang@acmcoder.com>

code optimization after review

Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-09-21 06:33:23 +08:00
Justin Terry (VM)
547bb94e4b Fix ctr run for Windows containers
1. Fixes bugs in ctr run that were introduced by 1d9b969
2. Adds support for the --isolated flag that runs Windows HyperV
cotainers instead of process isolated containers on Windows.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-09-20 14:28:36 -07:00
Justin Terry (VM)
7768ab1b5e Update runhcs-shim to use go-bindings
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-09-20 10:40:33 -07:00
John Howard
2586f3fbb9 boltdb/bolt --> go.etcd.io/bbolt
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-09-12 15:23:57 -07:00
Phil Estes
ed2bf6dd8a
Merge pull request #2624 from Ace-Tang/fix_delete_lock
fix: modify lock location of exec delete avoid exec hang
2018-09-11 10:26:32 -04:00
Ace-Tang
079292e3fc fix: modify lock location of exec delete
func (e *execProcess) delete(ctx context.Context) error {
    e.wg.Wait()
...
}
delete exec process will wait for io copy finish, if wait here,
other process can not get lock of shim service.

1. apply lock around s.transition() calls in the Delete methods.
2. put lock after wait io copy in exec Delete.

Signed-off-by: Ace-Tang <aceapril@126.com>
2018-09-11 13:22:59 +08:00
Michael Crosby
12c877f57a
Merge pull request #2618 from crosbymichael/no-stdin
Don't provide IO when it's not set
2018-09-10 11:26:49 -04:00
Michael Crosby
c48cafea40
Merge pull request #2619 from nashasha1/fix/typo-in-runtime
Fix some typo in runtime and snapshots
2018-09-10 09:32:34 -04:00
Xiaodong Zhang
e6d787172c Fix some typo in runtime and snapshots
Signed-off-by: Xiaodong Zhang <a4012017@sina.com>
2018-09-08 08:31:42 +08:00
Michael Crosby
906acb18b6 Don't provide IO when it's not set
This makes sure that runc does not get any valid IO for the pipe.  Some
builds and other containers will be stuck if they inspect stdin
expecially and its a pipe but not connected to any user input.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-09-07 18:30:31 -04:00
Justin Terry (VM)
ef910311e8 Add a Windows section for Linux oci on LCOW
When creating a default OCI spec on Windows that is targeting the LCOW
platform it needs to contain a Windows section as well. This adds the
Windows section by default. It also protects against this case for all
OCI creation that doesnt use the OCI package in the runhcs-shim.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-09-06 11:05:45 -07:00
Claudia Beresford
32e6aa742b Fix teeny tiny typos
Signed-off-by: Claudia Beresford <cberesford@pivotal.io>
2018-09-05 14:44:44 +01:00
yanxuean
517930187e remove useless parameter from newTask
Signed-off-by: yanxuean <yan.xuean@zte.com.cn>
2018-09-04 10:59:00 +08:00
Lantao Liu
7a4e0806c2 Fix runc state error handling.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-08-30 10:47:04 -07:00
Tom Godkin
b5ccc66c2c Do not kill all on task delete by default
- Still KillAll if the task uses the hosts pid namespace
 - Test for both host pid namespace and normal cases

Co-authored-by: Oliver Stenbom <ostenbom@pivotal.io>
Co-authored-by: Georgi Sabev <georgethebeatle@gmail.com>
Signed-off-by: Oliver Stenbom <ostenbom@pivotal.io>
2018-08-30 15:58:33 +01:00
Michael Crosby
2205e8d67a Improve shim locking
Only lock around shim state and not on actions

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-08-29 11:22:02 -04:00
Michael Crosby
d50e25360c Add context cancel for epoll
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-08-29 10:44:47 -04:00
Justin Terry (VM)
0110b3c0bc Introduce the Windows lcow diff/snaphotter
Implements the Windows lcow differ/snapshotter responsible for managing
the creation and lifetime of lcow containers on Windows.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-08-28 13:51:04 -07:00
Derek McGowan
ce1161f806
Merge pull request #2551 from crosbymichael/stdin-block
Don't block on STDIN open
2018-08-28 10:24:05 -07:00
Derek McGowan
be42d777ff
Merge pull request #2575 from crosbymichael/workdir
Remove and create workdir if state dir does not exist
2018-08-27 16:19:25 -07:00
Michael Crosby
ac78a5b615 Remove and create workdir if state dir does not exist
This is the case where the work dir could still exist if a machine
reboots, reseting the state dir.  On container creation, we should just
clear out the work dir.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-08-27 18:18:50 -04:00
Justin Terry (VM)
e88ec1f1a6 Fix incorrect ID usage in Windows runtime v2
Sometimes the wrong ID was being used because its not correct to assume
that ExecID is always set. The assumption was that for API's where it is
not an exec ID == ExecID but thats not true. ExecID == "" if it is not
an exec. This uses the correct ID in all cases.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-08-27 11:08:12 -07:00
Michael Crosby
bc1ff51411 Don't block on STDIN open
This was found testing other runtime shims that are faster than runc(no
containerization).  This is a race that can cause the shim to block
forever.  It's not an issue for out/err because we open both sides of
the pipe, but for stdin, it expects the client to have it opened.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-08-27 10:44:53 -04:00
Justin Terry (VM)
019b0c34de Introduce containerd-shim-runhcs-v1 on Windows
Implements the containerd-shim-runhcs-v1 shim on Windows for the runtime
v2 shim API.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-08-22 08:15:43 -07:00
Justin Terry (VM)
8362d9aa48 switch shim log Windows client/server direction
Switches the client/server direction of the shim-log pipe on Windows so
that the shim is the listener. This allows the containerd client to
reconnect as needed to the log streams.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-08-08 12:58:45 -07:00
Michael Crosby
6ba4ddfdda Add shim log pipe for log forwarding to the daemon
A fifo on unix or named pipe on Windows will be provided to the shim.
It can be located inside the `cwd` of the shim named "log".
The shims can use the existing `github.com/containerd/containerd/log` package to log debug messages.
Messages will automatically be output in the containerd's daemon logs with the correct fiels and runtime set.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-08-07 15:31:00 -04:00
Justin Terry (VM)
dcb905701c Adds retry support to Windows AnonDialer
Adds retry support to AnonDialer if the pipe does not exist. This will
retry up to the timeout for the pipe to exist and connect. This solves
the race between the containerd-shim-* start command and the
reinvocation.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-08-01 13:22:25 -07:00
Justin Terry (VM)
9f13b74f4a Runtime v2 absolute shim path to executable
Fixes an issue where the runtime v2 was not using an absolute path to
the executable but setting the .Dir field on the exec.Cmd. This causes
the executable to need to be relative to .Dir but no shim is actually
copied to the bundle directory that its work dir is set to.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-07-31 15:07:55 -07:00
Michael Crosby
23fbdbaf13 Cleanup workdirs on manager load
This cleans up persistent work dirs on TaskManager boot.  These dirs can
be left behind in a machine reboot.  The state in /run will not exist
but the work dir in the root does, we should cleanup work dirs when
tasks are not loaded.

This also improves error handling that would prevent the task manager
from loading when a single task fails to load or cleanup.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-07-30 10:21:04 -04:00
Derek McGowan
362405f7b5
Merge pull request #2495 from jterry75/runtime_v2_windows
Adds runtime v2 support for Windows shim's
2018-07-27 11:24:34 -07:00
Justin Terry (VM)
af1b6a026e Review feedback.
1. Moves the log message for each socket to the appropriate _unix and
_windows.go
2. Replaces all reference to Abstract Socket for Windows.
3. Adds support for ctrl+c on Windows to exit a shim.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-07-27 09:49:33 -07:00
Michael Crosby
13549f7a07 Abstract to SocketAddress
This updates some methods for cross platform use as well as unifying
_unix files.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-07-27 12:39:53 -04:00
Michael Crosby
9d72b4543b Handle windows signals
Since windows does not require a signal handler, we just block on the
channel forever so that it does not exit.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-07-26 11:24:20 -04:00
Michael Crosby
f15a1170d3 Add windows publisher
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-07-26 11:21:50 -04:00
Justin Terry (VM)
d3e0c163f8 Adds runtime v2 support for Windows shim's
Implements the various requirements for the runtime v2 code to abstract
away the unix/linux code into the appropriate platform level
abstractions to use the runtime v2 on Windows as well.

Adds support in the Makefile.windows to actually build the runtime v2
code for Windows by setting a shell environment BUILD_WINDOWS_V2=1
before calling make. (Note this disables the compilation of the Windows
runtime v1)

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-07-25 14:09:26 -07:00
Michael Crosby
710df57854 Fast path bundle cleanup on load
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-07-25 14:37:56 -04:00
Michael Crosby
0d52c71c80
Merge pull request #2474 from dmcgowan/lease-expiration
Improved lease management
2018-07-20 16:54:17 -04:00
Michael Crosby
17ab11a236 Fixes for runtimev2 and checkpoint restore
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-07-20 12:09:29 -04:00
Michael Crosby
d53a96fbe4 Add comments for oci protos
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-07-18 15:12:18 -04:00
Derek McGowan
8cf3fad8d4
Add leases manager interface
Add leases manager to the leases package and use the
interface on the client and service.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-07-18 10:43:37 -07:00
Michael Crosby
026b7d922f Add README.md to runtime v2
This readme specifies shim api and authoring docs.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-07-18 12:08:11 -04:00
Michael Crosby
fd31052d9c Add oom events to shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-07-17 16:52:05 -04:00
Michael Crosby
7e49c601a8 Add shim start for shim creation
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-07-17 10:21:29 -04:00
Michael Crosby
da1b5470cd Runtime v2
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-07-17 10:21:29 -04:00
Michael Crosby
08150bfe76 Update ttrpc for containerd repo
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-06-28 09:53:40 -04:00
Michael Crosby
68e144c637 Set shim max procs via env var
This sets the shim's max procs to 2, like we already have hard coded in
the shim, with the env var so that it is set at go runtime boot.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-06-26 10:49:59 -04:00
Evan Hazlett
a435f2886c separate proc interfaces into standalone package
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2018-06-07 10:03:15 -04:00
Evan Hazlett
821c8eaa91
runtime/linux/shim -> runtime/shim
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2018-06-06 14:35:06 -04:00
Evan Hazlett
cae94b930d linux -> runtime/linux
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2018-05-30 09:23:10 -04:00
Michael Crosby
c87ed12da5 Move restart pkg to runtime
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-05-22 17:13:40 -04:00
Michael Crosby
ceae112f7d Rename Runtime to PlatformRuntime
This renames the runtime interface to PlatformRuntime to denote the
layer at which the runtime is being abstracted.  This should be used to
abstract different platforms that vary greatly and do not have full
compat with OCI based binary runtimes.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-05-16 09:36:05 -04:00
Kunal Kushwaha
b12c3215a0 Licence header added
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2018-02-19 10:32:26 +09:00
Michael Crosby
95d4f53fbe Delete task on dead shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-02-06 12:46:06 -05:00
Lantao Liu
71e42bf65c Lock task list properly.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-12-03 21:20:01 +00: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
Jess
061c719209 ListPids returns process ID and other info
Signed-off-by: Jess <jessica.valarezo@docker.com>
2017-10-10 22:57:15 +00:00
Michael Crosby
451421b615 Comment more packages to pass go lint
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-02 13:54:56 -04:00
Michael Crosby
d67763d922 Add wait API endpoint for waiting on process exit
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-09-21 15:03:58 -04:00
Michael Crosby
d22160c28e Vendor typeurl package
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-09-19 09:43:55 -04:00
Michael Crosby
697dcdd407 Refactor task service metrics
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-09-05 17:26:26 -04:00
Kenfe-Mickael Laventure
3f34c421d3
Add missing "/tasks/exec-started" event topic
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-29 08:27:44 -07:00
Kenfe-Mickael Laventure
d541567119
Handle SIGKILL'ed shim while daemon is running
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-29 08:27:44 -07:00
Kenfe-Mickael Laventure
8a1b03e525
Add ExitedAt to process proto definition
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-21 08:18:02 -07:00
Michael Crosby
4950c26757 Revert "Wait for client side copy goroutines to start"
This reverts commit 06dc87ae59.

Revert "Change oom metric to const"

This reverts commit e800f08f9f.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-18 16:20:02 -04:00
Michael Crosby
e800f08f9f Change oom metric to const
This removes the metric vec that was holding onto all task id and
namespace combinations forever, until containerd was restarted.  This
was causing a memory leak with many task.

This also removes the shim cmd where the `Args` is quite large from the
reaper after the shim has been started cutting down on another leak.

This is the first pass through the reaper but more code is required to
fix all the issues when commands are added.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-17 16:23:20 -04:00
Michael Crosby
9f13b414b9 Return exit status from Wait of stopped process
This changes Wait() from returning an error whenever you call wait on a
stopped process/task to returning the exit status from the process.

This also adds the exit status to the Status() call on a process/task so
that a user can Wait(), check status, then cancel the wait to avoid
races in event handling.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-03 17:22:33 -04:00
Michael Crosby
a2a3451925 Implement Exec + Start for tasks service
This splits up the exec creation and start in the tasks service

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-02 13:50:08 -04:00
Kenfe-Mickael Laventure
674b460d5a
Move typeurl registrations to runtime package
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-07-21 18:19:51 +02:00
Kenfe-Mickael Laventure
61fbd2311c
windows: Refactor whole code
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-07-20 18:39:46 +02:00
Derek McGowan
a8504277cc Merge pull request #1209 from stevvooe/remove-errors
linux, linux/shim: remove error definitions
2017-07-18 19:18:23 -07:00
Stephen J Day
6d0bcd5aec
linux, linux/shim: remove error definitions
Since we now have a common set of error definitions, mapped to existing
error codes, we no longer need the specialized error codes used for
interaction with linux processes. The main issue was that string
matching was being used to map these to useful error codes. With this
change, we use errors defined in the `errdefs` package, which map
cleanly to GRPC error codes and are recoverable on either side of the
request.

The main focus of this PR was in removin these from the shim. We may
need follow ups to ensure error codes are preserved by the `Tasks`
service.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-07-18 15:56:49 -07:00
Kenfe-Mickael Laventure
e4beb7c554
Use constants for runtime event topics
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-07-18 14:19:48 +02:00
Kenfe-Mickael Laventure
88c1db5ca5
Move taskList to the runtime package
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-07-13 13:53:22 +02:00
Michael Crosby
6578565216 Use event service post for shim events
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-07 16:30:57 -07:00
Michael Crosby
f93bfb6233 Add Exec IDs
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-06 15:23:08 -07:00