lianetm commented on PR #18590:
URL: https://github.com/apache/kafka/pull/18590#issuecomment-2611089054

   Hey here, I don't quite get how the `pollOnClose` approach will solve the 
issue, basically because it still leaves a lot of time for unneeded FindCoord 
to be generated and block the network thread close, doesn't it? 
   
   The `pollOnClose` runs when we're closing the network thread, actually right 
before we block on `sendUnsentRequests`. This means that we may have already a 
`FindCoord` generated after the consumer close committed and left the group, 
correct?
   
   To find a solution, let's look at the classic consumer first, this is my 
understanding:
   
   - it does attempt to FindCoord to commit on close of course, here:
   
https://github.com/apache/kafka/blob/40890faa1bed8296919a7e108937ec559d901348/clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java#L980-L982
 (both commit sync and the pending async attempt to find if needed).
   
   - it does not attempt to FindCoord when attempting to `maybeLeaveGroup`. 
After the commit on close phase completes, the classic shutdowns the HB thread 
(so no more pro-active FindCoord), and then sends the leave req (only if there 
is a known coord, no-op if it's unknown)
   
https://github.com/apache/kafka/blob/40890faa1bed8296919a7e108937ec559d901348/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java#L1170
   
   Correct me there, but if that's the behaviour, could it be achieved in the 
new consumer by allowing the `autoCommitOnClose` run with the background 
ensuring a coordinator, but right after signaling to the CoordinatorReq manager 
that it's closing, so it does not generate any more FindCoord? That's what 
comes to mind, but let me know your thoughts. Thanks!


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