Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion server/sandbox_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ func (s *Server) networkStart(ctx context.Context, sb *sandbox.Sandbox) (podIPs
defer func() {
if retErr != nil {
log.Infof(ctx, "networkStart: stopping network for sandbox %s", sb.ID())
if err2 := s.networkStop(startCtx, sb); err2 != nil {
// use a new context to prevent an expired context from preventing a stop
if err2 := s.networkStop(context.Background(), sb); err2 != nil {
log.Errorf(ctx, "error stopping network on cleanup: %v", err2)
}
}
Expand Down
6 changes: 4 additions & 2 deletions server/sandbox_run_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,8 @@ func (s *Server) runPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
}
cleanupFuncs = append(cleanupFuncs, func() {
log.Infof(ctx, "runSandbox: in manageNSLifecycle, stopping network for sandbox %s", sb.ID())
if err2 := s.networkStop(ctx, sb); err2 != nil {
// use a new context to prevent an expired context from preventing a stop
if err2 := s.networkStop(context.Background(), sb); err2 != nil {
log.Errorf(ctx, "error stopping network on cleanup: %v", err2)
}
})
Expand Down Expand Up @@ -955,7 +956,8 @@ func (s *Server) runPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
}
cleanupFuncs = append(cleanupFuncs, func() {
log.Infof(ctx, "runSandbox: stopping network for sandbox %s when not manageNSLifecycle", sb.ID())
if err2 := s.networkStop(ctx, sb); err2 != nil {
// use a new context to prevent an expired context from preventing a stop
if err2 := s.networkStop(context.Background(), sb); err2 != nil {
log.Errorf(ctx, "error stopping network on cleanup: %v", err2)
}
})
Expand Down