Skip to content

Commit 6650510

Browse files
committed
Exit signal forward if process not found
Previously the signal loop can end up racing with the process exiting. Intead of logging and continuing the loop, exit early. Signed-off-by: Brian Goff <[email protected]>
1 parent d4e7820 commit 6650510

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

cmd/ctr/commands/signals.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"syscall"
2424

2525
"github.com/containerd/containerd"
26+
"github.com/containerd/containerd/errdefs"
2627
"github.com/sirupsen/logrus"
2728
)
2829

@@ -38,6 +39,10 @@ func ForwardAllSignals(ctx gocontext.Context, task killer) chan os.Signal {
3839
for s := range sigc {
3940
logrus.Debug("forwarding signal ", s)
4041
if err := task.Kill(ctx, s.(syscall.Signal)); err != nil {
42+
if errdefs.IsNotFound(err) {
43+
logrus.WithError(err).Debugf("Not forwarding signal %s", s)
44+
return
45+
}
4146
logrus.WithError(err).Errorf("forward signal %s", s)
4247
}
4348
}

0 commit comments

Comments
 (0)