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

Too many goroutines in gopark state #2839

Open
ajeyprasad opened this issue Mar 19, 2024 · 1 comment
Open

Too many goroutines in gopark state #2839

ajeyprasad opened this issue Mar 19, 2024 · 1 comment

Comments

@ajeyprasad
Copy link

ajeyprasad commented Mar 19, 2024

Description

We have implemented a single Kafka producer using Sarama, which multiple goroutines utilize to produce messages to Kafka. However, we have observed an excessive number of goroutines in the gopark state. What could be the possible cause for this?

Below is the image of goroutine dump:

gopark
Versions
Sarama Kafka Go
v1.40.1 2.8.1 1.18
@dnwe
Copy link
Collaborator

dnwe commented Mar 21, 2024

So from the displayed goroutine image it looks fairly normal. Your producer is writing to one or more topics totalling 2093 partitions. Sarama dedicates a parititionProducer to each partition. Each of these has a dispatch() loop which is waiting on an input channel to receive messages that you'd like it to send. When that input channel is empty they will block on the chanrecv waiting for input and the Go scheduler will park the goroutine until it needs to be woken when the channel receives input.

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