Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.8.0
Description
When the new consumer attempts to leave a group, it sends a leave group request in a fire-and-forget mode, so, as soon as the request is generated, it will:
1. transitions to UNSUBSCRIBED
2. complete the leaveGroup operation future
This task focus on point 2, which has the undesired side-effect that whatever might have been waiting for the leave to do something else, will carry on, ex. consumer close, leading to responses to disconnected clients we've seen when running stress tests)
When leaving a group while closing a consumer, the member sends the leave request and moves on to next operation, which is closing the network thread, so we end up with disconnected client receiving responses from the server. We should send leave group heartbeat, and transition to UNSUBSCRIBE, but only complete the leave operation when we get a response for it, which is a much more accurate confirmation that the consumer left the group and can move on with other operations.
Note that the legacy consumer does wait for a leave response before closing down the coordinator (see AbstractCoordinator), we we are looking to have the same behaviour on the new consumer.
Note that with this task we'll only focus on changing the behaviour for the leave operation completion (point 2 above) to tidy up the close flow. We are not changing the transition to UNSUBSCRIBED, as it would require further consideration if ever needed.
This is also a building block for future improvements around error handling for the leave request, which we don't have at the moment (related Jira linked)
Attachments
Issue Links
- relates to
-
KAFKA-15954 Review minimal effort approach on consumer last heartbeat on unsubscribe
- Open
- links to