runtime: ignore file-already-closed error if dead shim

fix: #5130

Signed-off-by: Wei Fu <fuweid89@gmail.com>
This commit is contained in:
Wei Fu
2021-03-12 15:37:07 +08:00
parent d8208e2e37
commit eabd9b98b6
3 changed files with 12 additions and 12 deletions

View File

@@ -22,10 +22,12 @@ import (
"context"
"io"
"net"
"os"
"path/filepath"
"time"
"github.com/containerd/fifo"
"github.com/pkg/errors"
"golang.org/x/sys/unix"
)
@@ -34,12 +36,9 @@ func openShimLog(ctx context.Context, bundle *Bundle, _ func(string, time.Durati
}
func checkCopyShimLogError(ctx context.Context, err error) error {
// When using a multi-container shim, the fifo of the 2nd to Nth
// container will not be opened when the ctx is done. This will
// cause an ErrReadClosed that can be ignored.
select {
case <-ctx.Done():
if err == fifo.ErrReadClosed {
if err == fifo.ErrReadClosed || errors.Is(err, os.ErrClosed) {
return nil
}
default: