-
Notifications
You must be signed in to change notification settings - Fork 339
Each batch processed twice. #517
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
Comments
It's very unlikely that your consumer is still in the group after 15-17 minutes of processing time – I don't think Kafka allows more than 30 seconds of "away time". I would either switch to single-message processing or ensure that batches are small enough that they can be processed in under 30 seconds. |
Also, you should upgrade to the most recent release of ruby-kafka. |
@dasch '~> 0.4' is in racecar's gemspec. |
@GeminPatel you should still be able to upgrade ruby-kafka to 0.5.1 even with that constraint. It's not documented in the README, but the code docs describe how you can limit the size of the returned batches on a per-partition level: https://github.com/zendesk/racecar/blob/437cb7e38349837f97bf46a65ae6e72b9648788c/lib/racecar/consumer.rb#L17-L18 |
Note that if you use |
This also happens on single message processing by the way. But the circumstances are a bit different. I was able to observer it on an older version of racecar where pause config was not present. Even in current version, if u specify pause as 0 you can reproduce this. Scenario: message processing should break due to raise. What is expected is that this message is retried only once. But this message will actually be processed twice. If you want I can give you example code and logs. [But because I am using pause, I do not much care about this issue]. |
The expectation is not that a message is retried once – it is retried indefinitely. |
I had seen this, but missed it. Thanks for pointing out. "The expectation is not that a message is retried once – it is retried indefinitely." Yeah I wanted to batch process as I am trying to do one time migration of 40 million messages and need to do this in constrained time. |
Are you using batch operations, or processing each message individually? The single-message processing mode still uses batching under the hood, it just makes sure to handle checkpointing in between message processing as per the offset commit policy (e.g. commit every n seconds or after n messages). It's typically what you want. |
Ok. This makes things much clear. I will try and follow on what I have understood. PS: I will put a code and log in sometime which will reproduce the bug I mentioned for single-message processing(#process) with pause 0. |
Config:
Consumer Code:
Run the code using: STDOUT:
issue_consumer.log
|
I think #518 will fix that problem. Can you try pinning your version of ruby-kafka to that commit and then test again? gem 'ruby-kafka', :git => 'https://github.com/zendesk/ruby-kafka.git', :ref => '4710d7d' |
Yes this fixes it. |
Fixed by #518. |
If this is a bug report, please fill out the following:
I am running a single batch consumer on a single broker kafka. There are 40k records in the topic so on the first batch fetch it is fetching around 11k records. Time taken in processing these records is 15-17 mins. And then when offset is tried to be commited, it reconnects as the connection is idle by definition. It reconnects and again starts from offset 0. Then it commits the correct offset. Then once the first 11k records are reprocessed, it moves to the next batch. Same is repeated for the next batch.
I am not uploading any code as I am using racecar and the the process batch function can be as simple as sleep for 100 milliseconds.
LOGS:
The text was updated successfully, but these errors were encountered: