From 5f0288e022512f0ddeb1ecf6d49b63adddce5abc Mon Sep 17 00:00:00 2001 From: Random-Liu Date: Mon, 22 May 2017 22:59:57 -0700 Subject: [PATCH] Double `StopContainer` request timeout. --- pkg/kubelet/remote/remote_runtime.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/kubelet/remote/remote_runtime.go b/pkg/kubelet/remote/remote_runtime.go index 31fda9abe89..f1f7bf25935 100644 --- a/pkg/kubelet/remote/remote_runtime.go +++ b/pkg/kubelet/remote/remote_runtime.go @@ -209,11 +209,10 @@ func (r *RemoteRuntimeService) StartContainer(containerID string) error { // StopContainer stops a running container with a grace period (i.e., timeout). func (r *RemoteRuntimeService) StopContainer(containerID string, timeout int64) error { - ctx, cancel := getContextWithTimeout(time.Duration(timeout) * time.Second) - if timeout == 0 { - // Use default timeout if stop timeout is 0. - ctx, cancel = getContextWithTimeout(r.timeout) - } + // Use timeout + default timeout (2 minutes) as timeout to leave extra time + // for SIGKILL container and request latency. + t := r.timeout + time.Duration(timeout)*time.Second + ctx, cancel := getContextWithTimeout(t) defer cancel() _, err := r.runtimeClient.StopContainer(ctx, &runtimeapi.StopContainerRequest{