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

consumer-group: do not cancel sessions context during rebalance #2193

Merged
merged 1 commit into from
Mar 30, 2022

Conversation

niamster
Copy link
Contributor

#2110 was merged to avoid stopping heatbeats on rebalance.
However, the change is not as effective as it could be since session context is canceled on rebalance (which results in the recreation of the session in the end).

This patch allows session consumer to continue its life if heartbeat loop detected rebalance event.

@lavoiesl
Copy link
Contributor

After moving from 1.30.0 to 1.32.0, we are encountering issues that rolling large Kafka clusters (in our case, it's over 100 brokers) can cause a lot of reconnections in quick successions on the producers. It can be witnessed with logs like:

consumergroup/session/%s/%d released
consumergroup/session/%s/%d heartbeat loop stopped
consumergroup/%s loop check partition number coroutine will exit, topics %s

I suspect it might be because of #2110.

If rolling a kafka cluster with many brokers and producers are handling a lot of messages, it can results in many of those messages stuck waiting for the producer clients to be ready, which can end up using it all memory and crashing.

@@ -869,7 +869,6 @@ func (s *consumerGroupSession) heartbeatLoop() {
retries = s.parent.config.Metadata.Retry.Max
case ErrRebalanceInProgress:
retries = s.parent.config.Metadata.Retry.Max
s.cancel()
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this makes sense.

@dnwe can you comment, since you authored #2110?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, I misread the PR, it's @pavius who authored the original PR

@dnwe
Copy link
Collaborator

dnwe commented Mar 28, 2022

@pavius 👋 can you comment on this PR?

@pavius
Copy link
Contributor

pavius commented Mar 29, 2022

@dnwe Unfortunately two years have passed since I made those changes and I don't remember the intricate details here - i.e. why I called cancel :(

@dnwe dnwe added the fix label Mar 30, 2022
@dnwe
Copy link
Collaborator

dnwe commented Mar 30, 2022

after re-reading this area of code, I think the change makes sense — lets merge and we can roll out main into some applications to test the functionality longer term

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants