sunm2n opened a new pull request, #24181:
URL: https://github.com/apache/kafka/pull/24181

   When the async consumer initializes positions, it sends an OffsetFetch 
request with the member ID and epoch. If the member is fenced while that 
request is in flight, the request fails with `UNKNOWN_MEMBER_ID` or 
`STALE_MEMBER_EPOCH` and `OffsetsRequestManager` propagates the error, so 
`poll()` throws for a situation the consumer recovers from on its own (the 
fenced member releases its assignment and rejoins).
   
   Fix by skipping the position initialization for that attempt: the partitions 
are left without positions, no error is propagated, and there is no fallback to 
the offset reset strategy (the partitions may have committed offsets that could 
not be read only because the member is no longer in the group). Positions are 
initialized on a following `poll()` if the partitions are still assigned. Calls 
reusing the same pending OffsetFetch complete the same way.
   
   The check is done in `OffsetsRequestManager` rather than in 
`CommitRequestManager` because `fetchOffsets` is shared with `committed()`, 
where the error should still reach the caller. `STALE_MEMBER_EPOCH` received 
while the member still has a valid epoch is unchanged (retried with the latest 
epoch).
   
   Other visible differences:
   - The same errors received while the consumer is unsubscribing are no longer 
cached and thrown by the next `poll()`.
   - `position()` for a partition in this state no longer throws the fencing 
error. It keeps waiting for the position within its timeout, as it does for any 
other initialization in progress.
   
   New tests in `OffsetsRequestManagerTest` cover both errors (update completes 
normally, no position set, no reset, no ListOffsets request), a following call 
sending a new OffsetFetch and setting the position, two calls sharing the 
pending request, and an unrelated error still failing the update. The first 
four fail without the change.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to