Skip to content

Commit fb7ec15

Browse files
committed
libcontainerd: work around exec start bug in c8d
It turns out that the unnecessary serialization removed in b752462 happened to work around a bug in containerd. When many exec processes are started concurrently in the same containerd task, it takes seconds to minutes for them all to start. Add the workaround back in, only deliberately this time. Signed-off-by: Cory Snider <[email protected]>
1 parent d5dc675 commit fb7ec15

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

libcontainerd/remote/client.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ type container struct {
6060
type task struct {
6161
containerd.Task
6262
ctr *container
63+
64+
// Workaround for https://github.com/containerd/containerd/issues/8557.
65+
// See also https://github.com/moby/moby/issues/45595.
66+
serializeExecStartsWorkaround sync.Mutex
6367
}
6468

6569
type process struct {
@@ -296,7 +300,12 @@ func (t *task) Exec(ctx context.Context, processID string, spec *specs.Process,
296300
// the stdin of exec process will be created after p.Start in containerd
297301
defer func() { stdinCloseSync <- p }()
298302

299-
if err = p.Start(ctx); err != nil {
303+
err = func() error {
304+
t.serializeExecStartsWorkaround.Lock()
305+
defer t.serializeExecStartsWorkaround.Unlock()
306+
return p.Start(ctx)
307+
}()
308+
if err != nil {
300309
// use new context for cleanup because old one may be cancelled by user, but leave a timeout to make sure
301310
// we are not waiting forever if containerd is unresponsive or to work around fifo cancelling issues in
302311
// older containerd-shim

0 commit comments

Comments
 (0)