lbradstreet commented on a change in pull request #10620: URL: https://github.com/apache/kafka/pull/10620#discussion_r624525594
########## File path: clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java ########## @@ -710,8 +710,11 @@ private boolean appendsInProgress() { */ public void awaitFlushCompletion() throws InterruptedException { try { - for (ProducerBatch batch : this.incomplete.copyAll()) - batch.produceFuture.await(); + // Make a copy of of the request results at the time the flush is called. + // We avoid making a copy of the full incomplete batch collections to allow + // garbage collection. Review comment: We do have a reference to incomplete, however the sender will remove the producer batches from the original incomplete collection. It's not currently doing so because we're making a full copy of incomplete. -- 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