-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Use proper locks when modifying alert status #760
Conversation
Hmm, CI is taking long, might be that there's a lock that's not getting released and blocking |
Oh, that's likely because SetSilenced can call SetActive, which also does the locking |
@@ -175,16 +180,15 @@ func (m *memMarker) Status(alert model.Fingerprint) AlertStatus { | |||
s, found := m.m[alert] | |||
if !found { | |||
s = &AlertStatus{} | |||
m.m[alert] = s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it ok to get rid of populating marker with empty state in the Status()
method? This way we avoid lock switching and as soon as we can Set*()
we'll insert proper status into the map.
Updated and now passing tests |
Locking is a bit tricky there since some state-modifying methods will call to other methods that also modify marker state, simple defer won't work.
Should this get merged and 0.6.2 be released? |
I would hope so, I'm sure @fabxc or @stuartnelson3 will review this when they get a chance, until that happens it's best to stay on 0.6.0 which shouldn't have any issues |
Sorry about not being responsive. LGTM |
Does this issue justify a new 0.6.x release? |
Read locks are used, which will cause panics @fabxc @stuartnelson3