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

   Hey @chia7712 , good point, you're right that the transition to LEAVING can 
only happen within the `runOnce`, meaning that we know it will poll the 
managers once right after. I was indeed thinking about the callbacks, where the 
transition to LEAVING happens async, but I was missing the fact that it can 
only be when processing the CallbackCompleted event in the background (so poll 
after). Still, I guess the situation could be that the poll skips generating 
the HB (ex. no coordinator), so we end up in a pollOnClose with state LEAVING?
    
   For context, I ended up in this corner case of pollOnClose + LEAVING while 
playing locally with some integration tests for close(0), with callbacks. 
Honestly I thought of the scenario I described above, missing the bit of the 
CallbackCompleted event. Still, re-thinking the root cause after your comment, 
I can only imagine this case: callbacks complete -> process events (transition 
to LEAVING) -> poll managers (skip due to no coord) -> runAtClose (pollOnClose 
in HB Mgr will be in LEAVING state). Makes sense? Corner case of course, but if 
the coordinator is known again at the time of closing,  the pollOnClose would 
save the situation by handling LEAVING (and not hurt since most of the times, 
the expectation is that pollOnClose would happen with state UNSUBSCRIBED and do 
nothing). Thoughts?


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