KAFKA-13126: guard against overflow when computing joinGroupTimeoutMs#11111
Merged
ableegoldman merged 4 commits intoapache:trunkfrom Jul 23, 2021
Merged
Conversation
joinGroupTimeoutMsjoinGroupTimeoutMs
vvcephei
requested changes
Jul 22, 2021
Contributor
vvcephei
left a comment
There was a problem hiding this comment.
Thanks, @ableegoldman ! These all look good except the one I marked.
| throw new IOException("Connection to " + node + " failed."); | ||
| } | ||
| long pollTimeout = expiryTime - attemptStartTime; | ||
| long pollTimeout = (startTime - attemptStartTime) + timeoutMs; |
Contributor
There was a problem hiding this comment.
This would still overflow if timeoutMs is MAX_VALUE, right?
Member
Author
There was a problem hiding this comment.
The startTime is set once at the beginning of the method while the attemptStartTime is initialized just before the first attempt and then updated again after every iteration. So the attemptStartTime is always greater than the startTime and therefore the quantity being added to the timeoutMs here is actually negative.
But I see how that's confusing, I'll refactor the expression to make this more clear
3 tasks
Member
|
Failed tests are unrelated. |
Member
Author
|
Merged to trunk |
xdgrulez
pushed a commit
to xdgrulez/kafka
that referenced
this pull request
Dec 22, 2021
…s` (apache#11111) Setting the max.poll.interval.ms to MAX_VALUE causes overflow when computing the joinGroupTimeoutMs and results in the JoinGroup timeout being set to the request.timeout.ms instead, which is much lower. This can easily make consumers drop out of the group, since they must rejoin now within 30s (by default) yet have no obligation to almost ever call poll() given the high max.poll.interval.ms, especially when each record takes a long time to process or the `max.poll.records` is also very large. We just need to check for overflow and fix it to Integer.MAX_VALUE when it occurs. Reviewers: Luke Chen <showuon@gmail.com>, John Roesler <vvcephei@apache.org>
MaximGonnissen
added a commit
to MaximGonnissen/kafka
that referenced
this pull request
May 29, 2022
…oupTimeoutMs`" Integrated PR from apache/kafka: apache#11111
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In older versions of Kafka Streams, the
max.poll.interval.msconfig was overridden by default toInteger.MAX_VALUE. Even after we removed this override, users of both the plain consumer client and kafka streams still set the poll interval to MAX_VALUE somewhat often. Unfortunately, this causes an overflow when computing thejoinGroupTimeoutMsand results in it being set to therequest.timeout.msinstead, which is much lower.This can easily make consumers drop out of the group, since they must rejoin now within 30s (by default) yet have no obligation to almost ever call poll() given the high
max.poll.interval.ms. We just need to check for overflow and fix it toInteger.MAX_VALUEwhen it occurs.Also fixes a few other misc. possible overflows on the side (from a ticket I came across while searching for existing tickets on the joinGroupTimeout bug: KAFKA-6948)