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

fix: race in sideload update #2531

Merged
merged 2 commits into from
Apr 14, 2021
Merged

fix: race in sideload update #2531

merged 2 commits into from
Apr 14, 2021

Conversation

docmerlin
Copy link
Contributor

@docmerlin docmerlin commented Apr 13, 2021

closes #2527

@@ -258,7 +262,10 @@ type httpSource struct {
}

func (s *httpSource) UpdateCache() error {
s.cache = make(map[string]map[string]interface{})
s.fileSource.mu.Lock()
Copy link
Contributor

Choose a reason for hiding this comment

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

should we lock for the whole update? seems like if these are happening in parallel it would be bad if we clean the cache, then start updating in one goroutine , then clean in a new goroutine, then finish updating from both goroutines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point.

Copy link
Contributor

@lesam lesam left a comment

Choose a reason for hiding this comment

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

Lgtm

@docmerlin docmerlin merged commit c5603f3 into master Apr 14, 2021
sranka pushed a commit that referenced this pull request May 1, 2021
@docmerlin docmerlin deleted the sideloadrace branch June 22, 2022 20:01
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.

1.5.9 panic: concurrent map read and map write
2 participants