Commit Graph

391 Commits

Author SHA1 Message Date
Kevin Parsons
daf12cd194 Improve error return from AnonDialer on Windows
AnonDialer will now return a "not found" error if the pipe is not found
before the timeout is reached. If the pipe exists but the timeout is
reached while attempting to connect, the timeout error will still be
returned.

This will allow the error handling logic to work properly when
connecting to the shim log pipe. An error message is only logged if the
error is not "not found", so now log noise from log pipes that were
never intended to be created by the shim will be hidden.

This change also cleans up the control flow for AnonDialer on Windows.
The new code should be more easily readable, but the only semantic
change is the error return value change.

Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
2019-07-30 17:20:37 -07:00
Michael Crosby
eb4b3e8772 Fast path getting pid from task
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-07-26 17:48:00 +00:00
dzzg
c27e48d666
fix mis-spelling in client.go
Signed-off-by: dzzg <zhengguang.zhu@daocloud.io>
2019-07-26 13:33:04 +08:00
Akihiro Suda
fab016c7a1 runtime/v1/linux: ignore ErrCgroupDeleted in Task.Start
Fix a Rootless Docker-in-Docker issue on Fedora 30: https://github.com/docker-library/docker/pull/165#issuecomment-511717143
Related: #1598

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2019-07-17 12:19:15 +09:00
Maksym Pavlenko
ef7f46eb7b Fix linter errors
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-07-14 20:49:40 -07:00
Michael Crosby
6601b406b7 Refactor runtime code for code sharing
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-07-08 11:47:53 -04:00
Phil Estes
2aa8780ce6
Merge pull request #3393 from lifupan/fix_deadshim
shimv2: remove the dead task from runtime task list
2019-07-08 11:42:55 -04:00
lifupan
ec8d9d3d7a shimv2: remove the dead task from runtime task list
When shimv2 dead, the container would be cleanup, but
the corresponding runtime task still existed in runtime
task lists, it should be deleted too.

Signed-off-by: lifupan <lifupan@gmail.com>
2019-07-04 15:51:03 +08:00
Derek McGowan
041d8d7051
Merge pull request #3366 from crosbymichael/exec-pid
Robust pid locking for shim processes
2019-06-29 15:36:51 +08:00
Michael Crosby
7dfc605fc6 Set shim OOM scores to +1 containerd daemon score
This changes the shim's OOM score from a static max killable of -999 to
be +1 of the containerd daemon's score.  This should allow the shim's to
be killed first in an OOM condition but leave the daemon alone for a bit
to help cleanup and manage the containers during this situation.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-06-27 11:14:14 -04:00
Michael Crosby
719a2c594e Robust pid locking for shim processes
Closes #2832

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-06-26 11:43:57 -04:00
Phil Estes
287582585f
Merge pull request #3365 from crosbymichael/exec-lk
Reserve exec id to prevent race
2019-06-25 08:59:41 +08:00
Maksym Pavlenko
174c4907d0 Fix shim's file IO logging
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-06-24 13:21:41 -07:00
Michael Crosby
1a8df3f237 Reserve exec id to prevent race
ref #2820

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-06-21 14:52:44 -04:00
Michael Crosby
245052243d Add timeout for I/O waitgroups
Closes #3286

This and a combination of a couple Docker changes are needed to fully
resolve the issue on the Docker side.  However, this ensures that after
processes exit, we still leave some time for the I/O to fully flush
before closing.  Without this timeout, the delete methods would block
forever.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-06-20 16:13:51 -04:00
Wei Fu
111b082e20
Merge pull request #3356 from mxpv/binary-io-path
BinaryIO/LogFile creator bug fixing
2019-06-20 10:25:47 +08:00
Maksym Pavlenko
fbf96d302a Fix path in LogFile creator
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-06-19 16:53:33 -07:00
Maksym Pavlenko
5e0d793801 Fix bugs in BinaryIO creator
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-06-19 11:15:17 -07:00
Ace-Tang
95f9bbf18b Add timeout in load shim v2
add timeout in connect shim v2 avoid starting containerd hang

Signed-off-by: Ace-Tang <aceapril@126.com>
2019-06-19 13:10:18 +08:00
Maksym Pavlenko
bca5667362 Make newBinaryIO public
Allow third-party runtime implementations to reuse NewBinaryIO
in order to support pluggable shim logging binary protocol.

Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-06-12 16:22:10 -07:00
Michael Crosby
42f4bb98ac
Merge pull request #3311 from jing-rui/shimlog
fix shim std logs not close after shim exit
2019-06-10 12:05:35 -04:00
Jing Rui
9e0cd529d3 fix shim std logs not close after shim exit
Signed-off-by: Jing Rui <jingrui@huawei.com>
2019-06-10 11:50:07 +08:00
Michael Crosby
ed308ea1e6 Unmount rootfs with separate Remove() in bundle
This ensures that a container does not have a mounted rootfs in the
bundle directory before RemoveAll is called.  Having the rootfs removed
first with a Remove ensures that the directory is not mounted and empty
before the bundle directory is removed.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-06-05 20:37:35 +00:00
Michael Crosby
7531c66d5a Ensure that the rootfs dir is created in the bundle
This fixes issues running gvisor on top of containerd without docker.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-06-03 19:56:19 +00:00
Danni Xia
bf24fb0cad Close file r.log after used to release resources.
Signed-off-by: Danni Xia <xiadanni1@huawei.com>
2019-06-04 06:41:38 +08:00
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