Don't use timeout package when stopping shim logger
containerd loads timeout values from config.toml and populated those values to `timeout` package at launch. So when using `timeout` package from shim, there are default values and config file is ignored. So use a hardcoded value for binary IO. Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
This commit is contained in:
parent
d8506bfd7b
commit
0dc7c85956
@ -34,7 +34,6 @@ import (
|
|||||||
"github.com/containerd/containerd/log"
|
"github.com/containerd/containerd/log"
|
||||||
"github.com/containerd/containerd/namespaces"
|
"github.com/containerd/containerd/namespaces"
|
||||||
"github.com/containerd/containerd/pkg/stdio"
|
"github.com/containerd/containerd/pkg/stdio"
|
||||||
"github.com/containerd/containerd/pkg/timeout"
|
|
||||||
"github.com/containerd/containerd/sys"
|
"github.com/containerd/containerd/sys"
|
||||||
"github.com/containerd/fifo"
|
"github.com/containerd/fifo"
|
||||||
runc "github.com/containerd/go-runc"
|
runc "github.com/containerd/go-runc"
|
||||||
@ -42,9 +41,7 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const binaryIOProcTermTimeout = 12 * time.Second // Give logger process solid 10 seconds for cleanup
|
||||||
shimLoggerTermTimeout = "io.containerd.timeout.shim.logger.shutdown"
|
|
||||||
)
|
|
||||||
|
|
||||||
var bufPool = sync.Pool{
|
var bufPool = sync.Pool{
|
||||||
New: func() interface{} {
|
New: func() interface{} {
|
||||||
@ -373,12 +370,10 @@ func (b *binaryIO) cancel() error {
|
|||||||
done <- err
|
done <- err
|
||||||
}()
|
}()
|
||||||
|
|
||||||
termTimeout := timeout.Get(shimLoggerTermTimeout)
|
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case err := <-done:
|
case err := <-done:
|
||||||
return err
|
return err
|
||||||
case <-time.After(termTimeout):
|
case <-time.After(binaryIOProcTermTimeout):
|
||||||
log.L.Warn("failed to wait for shim logger process to exit, killing")
|
log.L.Warn("failed to wait for shim logger process to exit, killing")
|
||||||
|
|
||||||
err := b.cmd.Process.Kill()
|
err := b.cmd.Process.Kill()
|
||||||
|
Loading…
Reference in New Issue
Block a user