ShivsundarR commented on PR #19886:
URL: https://github.com/apache/kafka/pull/19886#issuecomment-2965330373

   Hi @kirktrue, thanks for the review.
   Yes I agree, the consumer should be able to use the 30 seconds if needed. I 
think the abort here only happens when the request need not be sent anymore. 
The abort happens
   
   - only when `onClose` in the `ConsumerNetworkThread` is true, and 
   - `onClose` will be true only when the `ConsumerNetworkThread::cleanup` is 
called
   - The cleanup of network thread happens right at the end of close() 
[here](https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java#L1482)
 after the completion of `commitSync()`, and updating callbacks.
   - And anyway we do intend to stop sending `findCoordinator` requests before 
the network thread closes 
[here](https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java#L1474),
 so ideally this should not be a problem.
   
   - If there happened to be a `findCoordinator` request issued before the 
`stopFindCoordinatorOnClose` event was sent, that goes into a loop of retries 
when a node is unavailable. 
   - For `commitSync`/`acknowledgements`(for `ShareConsumers`) which occur 
during `close`, we do NOT abort the `findCoordinator` even when the node is 
unavailable(as `onClose` in `NetworkClientDelegate` would be false), the 
respective request managers will handle the response when broker is unavailable 
and the process will complete as it was happening before this change.
   - Once these stages complete, we reach the end when the network thread 
itself needs to close with the remaining time on the `closeTimeout`. 
   - Now, if there are any `unsent` requests with no node to connect to, we try 
to abort such requests as anyway we have to close the network thread and 
issuing a `FindCoordinator`(even if a node was available) is no longer useful 
beyond this point.
   
   This was my line of thought, does this sound good?


-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to