[
https://issues.apache.org/jira/browse/KAFKA-21453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18141702#comment-18141702
]
이선민 commented on KAFKA-21453:
-----------------------------
[~lianetm] I'd like to take this one if you haven't started working on it.
I traced the failure path through CommitRequestManager into
OffsetsRequestManager.refreshOffsets, where the failed OffsetFetch propagates
to poll().
I'm considering handling this in OffsetsRequestManager: when the OffsetFetch
for position initialization fails with UNKNOWN_MEMBER_ID, or with
STALE_MEMBER_EPOCH once the member no longer has a valid epoch, skip position
initialization for that attempt without propagating the error or falling back
to offset reset. The partitions would remain without positions while the
membership manager handles fencing and rejoining, so positions get fetched on a
subsequent poll. STALE_MEMBER_EPOCH while the member still has a valid epoch
would keep its existing retry behaviour.
I'd add regression coverage in OffsetsRequestManagerTest for the in-flight
fencing case, including UNKNOWN_MEMBER_ID arriving while the client still has a
valid epoch, and verifying that positions remain uninitialized and are fetched
on a later attempt.
Does this approach match what you had in mind? I'm leaning towards
OffsetsRequestManager to keep the change scoped to position initialization,
since CommitRequestManager.fetchOffsets is shared with committed(), but I'm
happy to handle it there if you prefer.
> Async consumer poll may throw
> UnknownMemberIdException/StaleMemberEpochException if fenced while
> OffsetFetch in-flight
> ----------------------------------------------------------------------------------------------------------------------
>
> Key: KAFKA-21453
> URL: https://issues.apache.org/jira/browse/KAFKA-21453
> Project: Kafka
> Issue Type: Bug
> Components: clients
> Reporter: Lianet Magrans
> Priority: Major
> Fix For: 4.5.0
>
>
> When the async consumer initializes positions with OffsetFetch, it includes
> the member ID and epoch. If the member gets fenced while that request is in
> flight, the request fails (UnknownMemberId/StaleMemberEpoch) and the error is
> wrongly thrown from consumer.poll.
> Under this case, I expect that the partitions should remain without position,
> the consumer should handle the fencing as usual (invoke onPartitionsLost and
> rejoin on next poll).
> With that, positions should be successfully retrieved after the member
> rejoins (positions are continuously updated as needed on poll)
> For this to happen it requires fencing happening while the OffsetFetch for
> positions is in-flight, because if the client knows it's fenced, it sends
> OffsetFetch without a member ID or epoch
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)