Skip to content

Commit 9fdc96c

Browse files
committed
runtime/v2: add comment for checkCopyShimLogError
After #4906, containerd opens fifo in read/write mode in linux platform The original comment doesn't correct and is removed by #5174. ``` // original comment // 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. ``` However, we should add comment for checkCopyShimLogError to mention why we call checkCopyShimLogError. The checkCopyShimLogError, it is to prevent the flood of expected error messages after task die and the expected errors depend on platform. Signed-off-by: Wei Fu <[email protected]>
1 parent 32a08f1 commit 9fdc96c

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

runtime/v2/binary.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ func (b *binary) Start(ctx context.Context, opts *types.Any, onClose func()) (_
9898
go func() {
9999
defer f.Close()
100100
_, err := io.Copy(os.Stderr, f)
101+
// To prevent flood of error messages, the expected error
102+
// should be reset, like os.ErrClosed or os.ErrNotExist, which
103+
// depends on platform.
101104
err = checkCopyShimLogError(ctx, err)
102105
if err != nil {
103106
log.G(ctx).WithError(err).Error("copy shim log")

runtime/v2/shim.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ func loadShim(ctx context.Context, bundle *Bundle, events *exchange.Exchange, rt
9797
go func() {
9898
defer f.Close()
9999
_, err := io.Copy(os.Stderr, f)
100+
// To prevent flood of error messages, the expected error
101+
// should be reset, like os.ErrClosed or os.ErrNotExist, which
102+
// depends on platform.
100103
err = checkCopyShimLogError(ctx, err)
101104
if err != nil {
102105
log.G(ctx).WithError(err).Error("copy shim log after reload")

0 commit comments

Comments
 (0)