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 on broker fetchRate metric #3017

Open
dejan-lokar opened this issue Nov 19, 2024 · 0 comments
Open

Data race on broker fetchRate metric #3017

dejan-lokar opened this issue Nov 19, 2024 · 0 comments

Comments

@dejan-lokar
Copy link

Description

A data race on broker fetchRate metric.

Write:

b.fetchRate = metrics.GetOrRegisterMeter("consumer-fetch-rate", b.metricRegistry)

Read:
if b.fetchRate != nil {

Versions

Sarama v1.43.3

Configuration
Logs
==================
WARNING: DATA RACE
Write at 0x00c0012a00a8 by goroutine 1156:
  github.com/IBM/sarama.(*Broker).Open.func1()
      external/gazelle~~go_deps~com_github_ibm_sarama/broker.go:221 +0xd71
  github.com/IBM/sarama.withRecover()
      external/gazelle~~go_deps~com_github_ibm_sarama/utils.go:43 +0x41
  github.com/IBM/sarama.(*Broker).Open.gowrap1()
      external/gazelle~~go_deps~com_github_ibm_sarama/broker.go:185 +0x33

Previous read at 0x00c0012a00a8 by goroutine 762:
  github.com/IBM/sarama.(*Broker).Fetch.func1()
      external/gazelle~~go_deps~com_github_ibm_sarama/broker.go:501 +0x44
  runtime.deferreturn()
      GOROOT/src/runtime/panic.go:605 +0x5d
  github.com/IBM/sarama.(*brokerConsumer).fetchNewMessages()
      external/gazelle~~go_deps~com_github_ibm_sarama/consumer.go:1135 +0x10e4
  github.com/IBM/sarama.(*brokerConsumer).subscriptionConsumer()
      external/gazelle~~go_deps~com_github_ibm_sarama/consumer.go:935 +0x144
  github.com/IBM/sarama.(*brokerConsumer).subscriptionConsumer-fm()
      <autogenerated>:1 +0x33
  github.com/IBM/sarama.withRecover()
      external/gazelle~~go_deps~com_github_ibm_sarama/utils.go:43 +0x41
  github.com/IBM/sarama.(*consumer).newBrokerConsumer.gowrap2()
      external/gazelle~~go_deps~com_github_ibm_sarama/consumer.go:874 +0x33

Goroutine 1156 (running) created at:
  github.com/IBM/sarama.(*Broker).Open()
      external/gazelle~~go_deps~com_github_ibm_sarama/broker.go:185 +0x571
  github.com/IBM/sarama.(*client).Coordinator()
      external/gazelle~~go_deps~com_github_ibm_sarama/client.go:654 +0xb7
  github.com/IBM/sarama.(*consumerGroupSession).heartbeatLoop()
      external/gazelle~~go_deps~com_github_ibm_sarama/consumer_group.go:1011 +0x49b
  github.com/IBM/sarama.newConsumerGroupSession.gowrap1()
      external/gazelle~~go_deps~com_github_ibm_sarama/consumer_group.go:838 +0x33

Goroutine 762 (running) created at:
  github.com/IBM/sarama.(*consumer).newBrokerConsumer()
      external/gazelle~~go_deps~com_github_ibm_sarama/consumer.go:874 +0x39c
  github.com/IBM/sarama.(*consumer).refBrokerConsumer()
      external/gazelle~~go_deps~com_github_ibm_sarama/consumer.go:245 +0x124
  github.com/IBM/sarama.(*consumer).ConsumePartition()
      external/gazelle~~go_deps~com_github_ibm_sarama/consumer.go:192 +0x7c7
  github.com/IBM/sarama.newConsumerGroupClaim()
      external/gazelle~~go_deps~com_github_ibm_sarama/consumer_group.go:1121 +0xa6
  github.com/IBM/sarama.(*consumerGroupSession).consume()
      external/gazelle~~go_deps~com_github_ibm_sarama/consumer_group.go:929 +0x22d
  github.com/IBM/sarama.newConsumerGroupSession.func2()
      external/gazelle~~go_deps~com_github_ibm_sarama/consumer_group.go:877 +0x10c
  github.com/IBM/sarama.newConsumerGroupSession.gowrap3()
      external/gazelle~~go_deps~com_github_ibm_sarama/consumer_group.go:878 +0x61
==================
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

1 participant