Skip to content

Commit 3ee6189

Browse files
cpuguy83thaJeztah
authored andcommitted
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]> (cherry picked from commit 6650510) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 1a36776 commit 3ee6189

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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)