Skip to content

Commit

Permalink
Merge pull request #6717 from concourse/fix-containerd-graceful
Browse files Browse the repository at this point in the history
more lenient context deadline checking for containerd graceful process termination
  • Loading branch information
Aidan Oldershaw committed Mar 23, 2021
2 parents 2644cdc + 46d87fa commit bde0371
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions worker/runtime/process_killer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ package runtime
import (
"context"
"fmt"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"strings"
"syscall"
"time"

Expand Down Expand Up @@ -77,12 +76,7 @@ func (p processKiller) Kill(
case exitStatus := <-procWaitStatus:
err = exitStatus.Error()
if err != nil {
grpcErr := status.Convert(err)
// grpc error is passed back as a string so we can't do the regular errors.Is() check
// but if we convert the error to an RPC Status object we get a standard status code
// to check against

if grpcErr.Code() == codes.DeadlineExceeded {
if strings.Contains(err.Error(), "context deadline exceeded") {
return ErrGracePeriodTimeout
}
return fmt.Errorf("waiting for exit status from grpc: %w", err)
Expand Down

0 comments on commit bde0371

Please sign in to comment.