Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

concurrent map issue #225

Merged

Conversation

shriramsharma
Copy link
Collaborator

@shriramsharma shriramsharma commented Jun 6, 2022

fixes #224
Added mutex to synchronize access to Get func.

Signed-off-by: Shriram Sharma <shriram_sharma@intuit.com>
@@ -69,6 +71,8 @@ func (s *serviceCache) getKey(service *k8sV1.Service) string {
}

func (s *serviceCache) Get(key string) *ServiceClusterEntry {
defer s.mutex.Unlock()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: should we reverse them? Have s.mutext.Lock() and then defer ?

@@ -69,6 +71,8 @@ func (s *serviceCache) getKey(service *k8sV1.Service) string {
}

func (s *serviceCache) Get(key string) *ServiceClusterEntry {
defer s.mutex.Unlock()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
defer s.mutex.Unlock()
s.mutex.Lock()
defer s.mutex.Unlock()

Signed-off-by: Shriram Sharma <shriram_sharma@intuit.com>
@shriramsharma shriramsharma merged commit 2acf60e into istio-ecosystem:master Jun 8, 2022
@shriramsharma shriramsharma deleted the concurrent_map_224 branch June 8, 2022 16:21
psikka1 pushed a commit to psikka1/admiral that referenced this pull request Jun 15, 2022
Signed-off-by: psikka1 <pankaj_sikka@intuit.com>
asushanthk pushed a commit that referenced this pull request Jul 21, 2022
Signed-off-by: sa <sushanth_a@intuit.com>
asushanthk pushed a commit that referenced this pull request Jul 21, 2022
Signed-off-by: sa <sushanth_a@intuit.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] fatal error: concurrent map iteration and map write when accesing remoteRegistry.RemoteControllers
4 participants