Skip to content

Commit

Permalink
Update error logging
Browse files Browse the repository at this point in the history
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
  • Loading branch information
mxpv committed Apr 27, 2024
1 parent 364985a commit d0447d8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
16 changes: 8 additions & 8 deletions cmd/containerd-shim-runc-v2/task/service.go
Expand Up @@ -24,15 +24,20 @@ import (
"os"
"sync"

"github.com/containerd/containerd/v2/api/types"
"github.com/containerd/cgroups/v3"
"github.com/containerd/cgroups/v3/cgroup1"
"github.com/containerd/errdefs"
runcC "github.com/containerd/go-runc"
"github.com/containerd/log"
"github.com/containerd/ttrpc"
"github.com/containerd/typeurl/v2"
"google.golang.org/protobuf/types/known/emptypb"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/containerd/cgroups/v3"
"github.com/containerd/cgroups/v3/cgroup1"
cgroupsv2 "github.com/containerd/cgroups/v3/cgroup2"
eventstypes "github.com/containerd/containerd/v2/api/events"
taskAPI "github.com/containerd/containerd/v2/api/runtime/task/v3"
"github.com/containerd/containerd/v2/api/types"
"github.com/containerd/containerd/v2/api/types/task"
"github.com/containerd/containerd/v2/cmd/containerd-shim-runc-v2/process"
"github.com/containerd/containerd/v2/cmd/containerd-shim-runc-v2/runc"
Expand All @@ -49,11 +54,6 @@ import (
"github.com/containerd/containerd/v2/pkg/userns"
"github.com/containerd/containerd/v2/protobuf"
ptypes "github.com/containerd/containerd/v2/protobuf/types"
"github.com/containerd/errdefs"
runcC "github.com/containerd/go-runc"
"github.com/containerd/log"
"github.com/containerd/ttrpc"
"github.com/containerd/typeurl/v2"
)

var (
Expand Down
8 changes: 6 additions & 2 deletions core/runtime/v2/manager.go
Expand Up @@ -21,6 +21,7 @@ import (
"context"
"errors"
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -528,7 +529,7 @@ func (m *TaskManager) tryStreamEvents(ctx context.Context, shim *shimTask) error
return nil
}

log.G(ctx).Info("using shim events streaming")
log.G(ctx).Debugf("using shim events streaming for task %s", shim.ID())

stream, err := shim.task.Events(context.Background(), nil)
if err != nil {
Expand All @@ -539,7 +540,10 @@ func (m *TaskManager) tryStreamEvents(ctx context.Context, shim *shimTask) error
for {
evt, err := stream.Recv()
if err != nil {
log.G(ctx).WithError(err).Error("failed to receive shim event from stream")
if !errors.Is(err, io.EOF) {
log.G(ctx).WithError(err).Error("failed to receive shim event from stream")
}

break
}

Expand Down

0 comments on commit d0447d8

Please sign in to comment.