From 57fe8fb084b2ab42ac1832ae9a35224fc796c0e3 Mon Sep 17 00:00:00 2001 From: Manikandan R Date: Sat, 21 Dec 2024 14:19:40 +0530 Subject: [PATCH] [YUNIKORN-3004] Lock User Trackers and Group Trackers map during delete operations (#1007) Closes: #1007 Signed-off-by: Manikandan R (cherry picked from commit 2113cd7e439c840330db313901d8f7855ab3b532) --- pkg/scheduler/ugm/manager.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/scheduler/ugm/manager.go b/pkg/scheduler/ugm/manager.go index e235f36b0..b7d7475b9 100644 --- a/pkg/scheduler/ugm/manager.go +++ b/pkg/scheduler/ugm/manager.go @@ -159,7 +159,9 @@ func (m *Manager) DecreaseTrackedResource(queuePath, applicationID string, usage if userTracker.decreaseTrackedResource(queuePath, applicationID, usage, removeApp) { log.Log(log.SchedUGM).Info("Removing user from manager", zap.String("user", user.User)) + m.Lock() delete(m.userTrackers, user.User) + m.Unlock() } // if the app did not have a group we're done otherwise update the groupTracker if appGroup == common.Empty { @@ -184,7 +186,9 @@ func (m *Manager) DecreaseTrackedResource(queuePath, applicationID string, usage zap.String("queue path", queuePath), zap.String("application", applicationID), zap.Bool("removeApp", removeApp)) + m.Lock() delete(m.groupTrackers, appGroup) + m.Unlock() } }