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 Kafka receiver closing ready channel multiple times #1696

Merged
merged 4 commits into from
Sep 2, 2020

Conversation

pavolloffay
Copy link
Member

Signed-off-by: Pavol Loffay ploffay@redhat.com

Description: <Describe what has changed.

Avoid closing ready channel multiple times.

Link to tracking Issue:

Fixes #1692

Testing: < Describe what testing was performed and which tests were added.>

Documentation: < Describe the documentation added.>

@codecov
Copy link

codecov bot commented Aug 31, 2020

Codecov Report

Merging #1696 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1696      +/-   ##
==========================================
+ Coverage   92.36%   92.38%   +0.01%     
==========================================
  Files         259      259              
  Lines       18201    18203       +2     
==========================================
+ Hits        16812    16816       +4     
+ Misses        976      975       -1     
+ Partials      413      412       -1     
Impacted Files Coverage Δ
receiver/kafkareceiver/kafka_receiver.go 100.00% <100.00%> (ø)
translator/internaldata/resource_to_oc.go 88.88% <0.00%> (+1.85%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update af64ac9...b5d88e5. Read the comment docs.

@@ -607,8 +607,6 @@ func (ms Metric) SetUnit(v string) {
(*ms.orig).Unit = v
}


Copy link
Member Author

Choose a reason for hiding this comment

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

make fmt seems to touch this file. I can revert if needed.

Copy link
Member

Choose a reason for hiding this comment

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

It shouldn't anymore.

@bogdandrutu
Copy link
Member

There is a data race in the test


logger *zap.Logger
}

var _ sarama.ConsumerGroupHandler = (*consumerGroupHandler)(nil)

func (c *consumerGroupHandler) Setup(session sarama.ConsumerGroupSession) error {
close(c.ready)
c.readyCloser.Do(func() {
Copy link
Member Author

Choose a reason for hiding this comment

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

The setup can be called multiple times

IBM/sarama#1793 (comment)

There is an issue with the example, as the Setup method could be called multiple times as part of when a member initially joins a group or a rebalance happens.

The example from sarama https://github.com/Shopify/sarama/blob/master/examples/consumergroup/main.go#L142 reinitializes the ready channel in the consumer loop that leads to data race. For us it's enough to close the ready channel once as it is used only once in receiver start method to block until receiver is ready to consumer mesages.

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
@pavolloffay
Copy link
Member Author

@bogdandrutu this is ready for review.

@tigrannajaryan tigrannajaryan merged commit f3b5b45 into open-telemetry:master Sep 2, 2020
hughesjj pushed a commit to hughesjj/opentelemetry-collector that referenced this pull request Apr 27, 2023
…pen-telemetry#1696)

* translatesfx: add support for multiple SA monitors of the same type

* translatesfx: respond to PR feedback
Troels51 pushed a commit to Troels51/opentelemetry-collector that referenced this pull request Jul 5, 2024
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.

kafka receiver panic: close of closed channel
3 participants