mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 12:14:48 +00:00
runtime: stop getting OOM events when ttrpc: closed error
getOOMEvents is a long-waiting call, it will retry when failed. For cases of agent shutdown, the retry should stop. When the agent hasn't detected agent has died, we can also check whether the error is "ttrpc: closed". Fixes: #3815 Signed-off-by: bin <bin@hyper.sh>
This commit is contained in:
parent
9495316145
commit
fb8be96194
@ -15,7 +15,6 @@ import (
|
|||||||
"github.com/containerd/containerd/api/types/task"
|
"github.com/containerd/containerd/api/types/task"
|
||||||
"github.com/containerd/containerd/mount"
|
"github.com/containerd/containerd/mount"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"google.golang.org/grpc/codes"
|
|
||||||
|
|
||||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
|
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
|
||||||
)
|
)
|
||||||
@ -156,13 +155,11 @@ func watchOOMEvents(ctx context.Context, s *service) {
|
|||||||
default:
|
default:
|
||||||
containerID, err := s.sandbox.GetOOMEvent(ctx)
|
containerID, err := s.sandbox.GetOOMEvent(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
shimLog.WithError(err).Warn("failed to get OOM event from sandbox")
|
if err.Error() == "ttrpc: closed" || err.Error() == "Dead agent" {
|
||||||
// If the GetOOMEvent call is not implemented, then the agent is most likely an older version,
|
shimLog.WithError(err).Warn("agent has shutdown, return from watching of OOM events")
|
||||||
// stop attempting to get OOM events.
|
|
||||||
// for rust agent, the response code is not found
|
|
||||||
if isGRPCErrorCode(codes.NotFound, err) || err.Error() == "Dead agent" {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
shimLog.WithError(err).Warn("failed to get OOM event from sandbox")
|
||||||
time.Sleep(defaultCheckInterval)
|
time.Sleep(defaultCheckInterval)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user