From 2a2743947e10c2029c0968108247ffbc516284dd Mon Sep 17 00:00:00 2001 From: Rahul Jadhav Date: Wed, 16 Feb 2022 18:59:09 +0530 Subject: [PATCH] feeder: solved deadlock issue with telemetry Fixes: #622 Signed-off-by: Rahul Jadhav --- KubeArmor/feeder/feeder.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/KubeArmor/feeder/feeder.go b/KubeArmor/feeder/feeder.go index b81d067ba5..ed78ccdcd8 100644 --- a/KubeArmor/feeder/feeder.go +++ b/KubeArmor/feeder/feeder.go @@ -242,7 +242,7 @@ func (ls *LogService) WatchLogs(req *pb.RequestMessage, svr pb.LogService_WatchL case codes.OK: // noop case codes.Unavailable, codes.Canceled, codes.DeadlineExceeded: - kg.Warnf("Failed to send a log=[%+v] err=[%s]", resp, status.Err().Error()) + kg.Warnf("Failed to send a log=[%+v] err=[%s] CODE=%d", resp, status.Err().Error(), status.Code()) return status.Err() default: return nil @@ -497,8 +497,8 @@ func (fd *Feeder) PushMessage(level, message string) { pbMsg.Level = level pbMsg.Message = message - MsgLock.Lock() - defer MsgLock.Unlock() + // MsgLock.Lock() + // defer MsgLock.Unlock() for uid := range MsgStructs { MsgStructs[uid].Broadcast <- &pbMsg @@ -587,8 +587,8 @@ func (fd *Feeder) PushLog(log tp.Log) { pbAlert.Result = log.Result - AlertLock.Lock() - defer AlertLock.Unlock() + // AlertLock.Lock() + // defer AlertLock.Unlock() for uid := range AlertStructs { AlertStructs[uid].Broadcast <- &pbAlert @@ -624,8 +624,8 @@ func (fd *Feeder) PushLog(log tp.Log) { pbLog.Result = log.Result - LogLock.Lock() - defer LogLock.Unlock() + // LogLock.Lock() + // defer LogLock.Unlock() for uid := range LogStructs { LogStructs[uid].Broadcast <- &pbLog