-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Acknowledgment.nack() leads to infinite consumer pause when asyncAck property set to true #2410
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
Thanks for reporting; actually we shouldn't be completely clearing the Bear in mind that using async acks with nack is going to cause redelivery of some records that were previously acked. Lets say we deliver offsets 0-5 and you ack 0, 2, 4, 5 and nack3 followed by ack 1. With this code corrected, we will commit offset 2 and redeliver 3, 4, 5. Bottom line is that if you are using out of order commits with nack, you will need to deal with possible duplicates. |
It turns out that this is much more complicated than I thought it would be. Can you explain your use case? Given that |
|
Nope - that didn't work; I am back to being inclined to disallow it; but I will give it some more thought overnight. |
We also ran into the issue and was not expecting the above behaviour. For us we wanted to take advantages of async calls to I was thinking maybe perhaps a property to set a max time for a |
When using out of order commits, it is impossible to honor that contract - in fact the application might It was an oversight to allow |
Resolves spring-projects#2410 `nack()` cannot be used with out of order commits - the contract means commit all previous offsets and redeliver remaining. - the appliation might nack multiple records. **cherry-pick to 2.9.x, 2.8.x**
Resolves #2410 `nack()` cannot be used with out of order commits - the contract means commit all previous offsets and redeliver remaining. - the appliation might nack multiple records. **cherry-pick to 2.9.x, 2.8.x**
Resolves #2410 `nack()` cannot be used with out of order commits - the contract means commit all previous offsets and redeliver remaining. - the appliation might nack multiple records. **cherry-pick to 2.9.x, 2.8.x** # Conflicts: # spring-kafka-docs/src/main/asciidoc/kafka.adoc
Resolves #2410 `nack()` cannot be used with out of order commits - the contract means commit all previous offsets and redeliver remaining. - the appliation might nack multiple records. **cherry-pick to 2.9.x, 2.8.x** # Conflicts: # spring-kafka-docs/src/main/asciidoc/kafka.adoc
Version 2.8.9
Description
Call of Acknowledgment.nack() leads to infinite consumer pause when container property asyncAck set to true.
The problem seems to be with nack() implementation, as it only clears
offsetsInThisBatch
values but not map itself:Subsequent call of
private void doResumeConsumerIfNeccessary() {
does not resume consumer, sinceoffsetsInThisBatch.size() > 0
.To Reproduce
Try to call nack() with asyncAck set to true
Expected behavior
Consumer continues to read messages after specified sleep time out.
Sample
https://github.com/Neverhood565/spring-kafka-nack-bug
The text was updated successfully, but these errors were encountered: