[ 
https://issues.apache.org/jira/browse/KAFKA-17116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17869536#comment-17869536
 ] 

TengYao Chi commented on KAFKA-17116:
-------------------------------------

Hello folks,

This is a very interesting discussion, and I have learned a lot from it. The 
diverse perspectives shared here have been incredibly enlightening.

In my opinion, I think option_1 is the easier solution for this issue. As 
[~chia7712] mentioned, it would be a challenge to deal with compatibility if we 
select option_2, and it also needs additional logic to distinguish the member 
state.
I’m also wondering if it is possible to achieve this without changing the 
protocol. I think an additional field might be necessary.

The reason I support option_1 is that I have tried to implement a similar 
solution in the current 
[PR|https://github.com/apache/kafka/pull/16649/commits/9ee0e4e747fc1e851d736b173fdf881f844ba888#diff-0986b8c04dc1682e67717eb5e4a513e36d5fb9a3ab5ff4b90dd7efcd9b105712].
 Compared to option_2, the solution is quite simple, and it could be even 
simpler if we leverage `taggedFields` to send the temporary ID. In this way, we 
also don’t need to change the protocol. We only need to add some simple logic 
to handle the leave heartbeat without a correct memberId. The only concern will 
be the UUID generation from the client side (according to [~chia7712] , maybe 
this is not the case now).

> New consumer may not send effective leave group if member ID received after 
> close 
> ----------------------------------------------------------------------------------
>
>                 Key: KAFKA-17116
>                 URL: https://issues.apache.org/jira/browse/KAFKA-17116
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients, consumer
>    Affects Versions: 3.8.0
>            Reporter: Lianet Magrans
>            Assignee: TengYao Chi
>            Priority: Major
>              Labels: kip-848-client-support
>             Fix For: 3.9.0
>
>
> If the new consumer is closed after sending a HB to join, but before 
> receiving the response to it, it will send a leave group request but without 
> member ID (will simply fail with UNKNOWN_MEMBER_ID). This will make that the 
> broker will have a registered new member, for which it will never receive a 
> leave request for it.
>  # consumer.subscribe -> sends HB to join, transitions to JOINING
>  # consumer.close -> will transition to LEAVING and send HB with epoch -1 
> (without waiting for in-flight requests)
>  # consumer receives response to initial HB, containing the assigned member 
> ID. It will simply ignore it because it's not in the group anymore 
> (UNSUBSCRIBED)
> Note that the expectation, with the current logic, and main downsides of this 
> are:
>  # If the case was that the member received partitions on the first HB, those 
> partitions won't be re-assigned (broker waiting for the closed consumer to 
> reconcile them), until the rebalance timeout expires. 
>  # Even if no partitions were assigned to it, the member will remain in the 
> group from the broker point of view (but not from the client POV). The member 
> will be eventually kicked out for not sending HBs, but only when it's session 
> timeout expires.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to