8000 Merge pull request #140 from andrewhsu/d · docker-archive/engine@484a3c3 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 484a3c3

Browse files
authored
Merge pull request #140 fro 8000 m andrewhsu/d
[18.09] libcontainerd: prevent exec delete locking
2 parents cc7773c + 6646d08 commit 484a3c3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

libcontainerd/client_daemon.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
"github.com/containerd/typeurl"
3030
"github.com/docker/docker/errdefs"
3131
"github.com/docker/docker/pkg/ioutils"
32-
"github.com/opencontainers/image-spec/specs-go/v1"
32+
v1 "github.com/opencontainers/image-spec/specs-go/v1"
3333
specs "github.com/opencontainers/runtime-spec/specs-go"
3434
"github.com/pkg/errors"
3535
"github.com/sirupsen/logrus"
@@ -384,6 +384,11 @@ func (c *client) Exec(ctx context.Context, containerID, processID string, spec *
384384
defer close(stdinCloseSync)
385385

386386
if err = p.Start(ctx); err != nil {
387+
// use new context for cleanup because old one may be cancelled by user, but leave a timeout to make sure
388+
// we are not waiting forever if containerd is unresponsive or to work around fifo cancelling issues in
389+
// older containerd-shim
390+
ctx, cancel := context.WithTimeout(context.Background(), 45*time.Second)
391+
defer cancel()
387392
p.Delete(ctx)
388393
ctr.deleteProcess(processID)
389394
return -1, wrapError(err)

0 commit comments

Comments
 (0)
0