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

Data race between StandardMeter Stop and Mark #245

Closed
sykesm opened this issue Oct 1, 2018 · 1 comment
Closed

Data race between StandardMeter Stop and Mark #245

sykesm opened this issue Oct 1, 2018 · 1 comment

Comments

@sykesm
Copy link
Contributor

sykesm commented Oct 1, 2018

The implementation of Stop is using a lock instead of atomic.CompareAndSwapUint32 to serialize the stopped flag. This races with the implementation of Mark that uses atomic.LoadUint32 as there is no serialization guarantee between the two.

WARNING: DATA RACE
Write at 0x00c420312478 by goroutine 126:
  github.com/hyperledger/fabric/vendor/github.com/rcrowley/go-metrics.(*StandardMeter).Stop()
      /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/rcrowley/go-metrics/meter.go:151 +0x6f
  github.com/hyperledger/fabric/vendor/github.com/rcrowley/go-metrics.(*StandardRegistry).stop()
      /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/rcrowley/go-metrics/registry.go:227 +0xe4
  github.com/hyperledger/fabric/vendor/github.com/rcrowley/go-metrics.(*StandardRegistry).Unregister()
      /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/rcrowley/go-metrics/registry.go:189 +0x8f
  github.com/hyperledger/fabric/vendor/github.com/Shopify/sarama.(*Broker).Close()
      /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/Shopify/sarama/broker.go:186 +0x6cc
  github.com/hyperledger/fabric/vendor/github.com/Shopify/sarama.safeAsyncClose.func1()
      /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/Shopify/sarama/utils.go:52 +0x70
  github.com/hyperledger/fabric/vendor/github.com/Shopify/sarama.withRecover()
      /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/Shopify/sarama/utils.go:45 +0x50

Previous read at 0x00c420312478 by goroutine 111:
  sync/atomic.LoadInt32()
      /opt/go/src/runtime/race_amd64.s:206 +0xb
  github.com/hyperledger/fabric/vendor/github.com/rcrowley/go-metrics.(*StandardMeter).Mark()
      /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/rcrowley/go-metrics/meter.go:167 +0x42
  github.com/hyperledger/fabric/vendor/github.com/Shopify/sarama.(*Broker).updateOutgoingCommunicationMetrics()
      /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/Shopify/sarama/broker.go:878 +0x1db
  github.com/hyperledger/fabric/vendor/github.com/Shopify/sarama.(*Broker).send()
      /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/Shopify/sarama/broker.go:582 +0x50c
  github.com/hyperledger/fabric/vendor/github.com/Shopify/sarama.(*Broker).sendAndReceive()
      /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/Shopify/sarama/broker.go:601 +0x80
  github.com/hyperledger/fabric/vendor/github.com/Shopify/sarama.(*Broker).Produce()
      /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/Shopify/sarama/broker.go:267 +0x138
  github.com/hyperledger/fabric/vendor/github.com/Shopify/sarama.(*asyncProducer).newBrokerProducer.func1()
      /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/Shopify/sarama/async_producer.go:572 +0xe1
  github.com/hyperledger/fabric/vendor/github.com/Shopify/sarama.withRecover()
      /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/Shopify/sarama/utils.go:45 +0x50
@tsuna
Copy link

tsuna commented Oct 11, 2018

Ping. Just ran into this issue too.

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

No branches or pull requests

2 participants