Skip to content

Commit

Permalink
Adding locking on delete in UtilisationEventReporter (#411)
Browse files Browse the repository at this point in the history
We have been seeing a fatal error occasionally on concurrent map access we believe is coming from UtilisationEventReporter.

It looks like the lack of locking on delete is the most likely candidate (We can be iterating and deleting at the same time due to lack of the lock).
  • Loading branch information
JamesMurkin committed Aug 11, 2020
1 parent 476a0e0 commit 709ca7f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/executor/service/job_utilisation_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ func (r *UtilisationEventReporter) deletePod(pod *v1.Pod) {
if !util.IsManagedPod(pod) {
return
}
r.dataAccessMutex.Lock()
defer r.dataAccessMutex.Unlock()
delete(r.podInfo, pod.Name)
}

Expand Down

0 comments on commit 709ca7f

Please sign in to comment.