Skip to content

Commit e69b21c

Browse files
manirajv06craigcondit
authored andcommitted
[YUNIKORN-3004] Lock User Trackers and Group Trackers map during delete operations (#1007)
Closes: #1007 Signed-off-by: Manikandan R <[email protected]> (cherry picked from commit 2113cd7)
1 parent 637a6ed commit e69b21c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/scheduler/ugm/manager.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ func (m *Manager) DecreaseTrackedResource(queuePath, applicationID string, usage
159159
if userTracker.decreaseTrackedResource(queuePath, applicationID, usage, removeApp) {
160160
log.Log(log.SchedUGM).Info("Removing user from manager",
161161
zap.String("user", user.User))
162+
m.Lock()
162163
delete(m.userTrackers, user.User)
164+
m.Unlock()
163165
}
164166
// if the app did not have a group we're done otherwise update the groupTracker
165167
if appGroup == common.Empty {
@@ -184,7 +186,9 @@ func (m *Manager) DecreaseTrackedResource(queuePath, applicationID string, usage
184186
zap.String("queue path", queuePath),
185187
zap.String("application", applicationID),
186188
zap.Bool("removeApp", removeApp))
189+
m.Lock()
187190
delete(m.groupTrackers, appGroup)
191+
m.Unlock()
188192
}
189193
}
190194

0 commit comments

Comments
 (0)