-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Issue hitting max records in a batch #3119
Comments
Following commits back to the first commit with this limit:
It seems it was just an arbitrary choice to prevent trying to allocate “unreasonable” array lengths. We probably ought to limit it against how many objects could remain if the whole rest of the packet were the array. (Or the number of bytes remaining.) This should prevent most malicious encodings? |
@puellanivis yeah I think what you're suggesting makes sense. Usually an invalid encoding will result in a stupendously large number anyways, there's a lot more wiggle room, but kafka batches can be really large in terms of record count, especially if the messages are small |
created getArrayLengthNoLimit as record batches can container more then 2*math.MaxUint16 records. The packet decoder will make sure then the array length isn't greater then the number of bytes remaining to be decoding in the packet. Also added a test for large record counts. Fixes: IBM#3119
created `getArrayLengthNoLimit` as record batches can contain more than `2*math.MaxUint16 records`. The packet decoder will make sure that the array length isn't greater than the number of bytes remaining to be decoding in the packet. Also added a test for large record counts. Fixes: IBM#3119
Hey All, I made a PR to fix this issue #3120 |
created `getArrayLengthNoLimit` as record batches can contain more than `2*math.MaxUint16 records`. The packet decoder will make sure that the array length isn't greater than the number of bytes remaining to be decoding in the packet. Also added a test for large record counts. Fixes: IBM#3119 Signed-off-by: Ryan Belgrave <[email protected]>
I tested using this branch and it appears to work perfectly. Thank you. |
I'm curious about this one as they explicitly document that you might have to tune-up your MaxBytes. From their documentation:
However, my preference to fix this right now would probably be for us to replace the |
The Issue
My team is getting this invalid array length error in our consumer:
{"level":"info","msg":"consumer/broker/1395569342 disconnecting due to error processing FetchRequest: kafka: error decoding packet: invalid array length","time":"2025-02-27 20:17:36"}
I tracked the error down and it looks like its happening here:
sarama/record_batch.go
Line 160 in 9bf344f
sarama/real_decoder.go
Line 116 in 9bf344f
Unless I am mistaken, it appears that the maximum number of records in a batch is set at
131070
.The Question
Is there a reason the max records in a batch is set at
131070
?More Background
My team is consuming a lot of small records from confluents warpstream product. For whatever reason, it looks like Fetch Max gets ignored by the warpstream product, so that unfortunately is not a solution for us.
The text was updated successfully, but these errors were encountered: