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 data race #27

Closed
marctc opened this issue Jun 30, 2022 · 0 comments · Fixed by #29
Closed

Fix data race #27

marctc opened this issue Jun 30, 2022 · 0 comments · Fixed by #29

Comments

@marctc
Copy link
Contributor

marctc commented Jun 30, 2022

Running go test -race reports a potential race condition:

==================
WARNING: DATA RACE
Read at 0x00c00038c090 by goroutine 101:
  runtime.racereadrange()
      <autogenerated>:1 +0x1b
  github.com/grafana/vmware_exporter/vsphere.(*vsphereCollector).collectResource.func2()
      /home/marctc/workspace/vmware_exporter/vsphere/collector.go:113 +0x66

Previous write at 0x00c00038c090 by goroutine 98:
  github.com/grafana/vmware_exporter/vsphere.(*vsphereCollector).collectResource.func1()
      /home/marctc/workspace/vmware_exporter/vsphere/collector.go:111 +0x356
  github.com/grafana/vmware_exporter/vsphere.(*vsphereCollector).collectResource.func2()
      /home/marctc/workspace/vmware_exporter/vsphere/collector.go:113 +0x66

Goroutine 101 (running) created at:
  github.com/grafana/vmware_exporter/vsphere.(*vsphereCollector).collectResource()
      /home/marctc/workspace/vmware_exporter/vsphere/collector.go:106 +0xdea
  github.com/grafana/vmware_exporter/vsphere.(*vsphereCollector).Collect.func1()
      /home/marctc/workspace/vmware_exporter/vsphere/collector.go:56 +0x153
  github.com/grafana/vmware_exporter/vsphere.(*vsphereCollector).Collect.func2()
      /home/marctc/workspace/vmware_exporter/vsphere/collector.go:57 +0x66

Goroutine 98 (finished) created at:
  github.com/grafana/vmware_exporter/vsphere.(*vsphereCollector).collectResource()
      /home/marctc/workspace/vmware_exporter/vsphere/collector.go:106 +0xdea
  github.com/grafana/vmware_exporter/vsphere.(*vsphereCollector).Collect.func1()
      /home/marctc/workspace/vmware_exporter/vsphere/collector.go:56 +0x153
  github.com/grafana/vmware_exporter/vsphere.(*vsphereCollector).Collect.func2()
      /home/marctc/workspace/vmware_exporter/vsphere/collector.go:57 +0x66
==================
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 a pull request may close this issue.

1 participant