thomaslee commented on pull request #9111:
URL: https://github.com/apache/kafka/pull/9111#issuecomment-669624137


   It's somewhat easy to do it accidentally. The scenario I was concerned about 
looks something like this with auto offset commits disabled:
   
   ```java
   KafkaConsumer<...> consumer = ...;
   Map<TopicPartition, OffsetAndMetadata> offsets = new HashMap<>();
   
   //
   // in a message processing loop
   //
   consumer.commitAsync(offsets);
   offsets = new HashMap<>();
   
   //
   // before a rebalance (e.g. onPartitionsRevoked)
   //
   consumer.commitSync(offsets);
   ```
   
   Per the docs the `commitSync` call should ensure that the async commit 
finishes prior to the rebalance, but it may not if `offsets` is empty here.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to