junrao commented on code in PR #21065:
URL: https://github.com/apache/kafka/pull/21065#discussion_r2673470117


##########
clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java:
##########
@@ -1132,7 +1156,7 @@ void abortBatches(final RuntimeException reason) {
                 dq.remove(batch);
             }
             batch.abort(reason);
-            deallocate(batch);
+            completeBatchAndDeallocate(batch);

Review Comment:
   For the maybeAbortBatches() call in the following method, we only call that 
when the initPid call failed. At that point, no batches could be sent. So, it 
doesn't seem this exposes the buffer reuse issue.
   
   ```
       private boolean shouldHandleAuthorizationError(RuntimeException 
exception) {
           if (exception instanceof TransactionalIdAuthorizationException ||
                           exception instanceof ClusterAuthorizationException) {
               transactionManager.failPendingRequests(new 
AuthenticationException(exception));
               maybeAbortBatches(exception);
               transactionManager.transitionToUninitialized(exception);
               return true;
           }
           return false;
       }
   ```
   
   So, the remaining question is whether the buffer reuse issue could happen 
when the TxnManager is in the fatal state.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to