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: Fix concurrency issues with metrics #3401

Merged
merged 1 commit into from Jul 7, 2020
Merged

Conversation

simster7
Copy link
Member

@simster7 simster7 commented Jul 7, 2020

Fixes: #3391

@@ -89,28 +91,41 @@ func (m *Metrics) allMetrics() []prometheus.Metric {
}

func (m *Metrics) WorkflowAdded(key string, phase v1alpha1.NodePhase) {
if m.workflows[key] {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you simplify to use sync.Mutex for and defer. I think the benefit of simpler code would outweight the reduced efficiency.

@@ -34,6 +35,7 @@ type metric struct {
}

type Metrics struct {
workflowsMutex sync.RWMutex
Copy link
Contributor

Choose a reason for hiding this comment

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

you might want to comment and say what fields this is used to lock on

Copy link
Contributor

@alexec alexec left a comment

Choose a reason for hiding this comment

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

Can we please backport to v2.9?

@simster7 simster7 merged commit 7011160 into argoproj:master Jul 7, 2020
@simster7
Copy link
Member Author

simster7 commented Jul 7, 2020

Back-ported to 2.9.2

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.

fatal error: concurrent map read and map write
2 participants