private void transitionToStale() {
        transitionTo(MemberState.STALE);

        // Release assignment
        CompletableFuture<Void> callbackResult = invokeOnPartitionsLostCallback(subscriptions.assignedPartitions());
        staleMemberAssignmentRelease = callbackResult.whenComplete((result, error) -> {
            if (error != null) {
                log.error("onPartitionsLost callback invocation failed while releasing assignment" +
                    " after member left group due to expired poll timer.", error);
            }
            clearAssignment();
            log.debug("Member {} sent leave group heartbeat and released its assignment. It will remain " +
                "in {} state until the poll timer is reset, and it will then rejoin the group",
                memberId, MemberState.STALE);
        });
    }
Transition to STALE to release assignments because the member has left the group due to
expired poll timer. This will trigger the onPartitionsLost callback. Once the callback
completes, the member will remain stale until the poll timer is reset by an application
poll event. See {@link #maybeRejoinStaleMember()}.
clients/src/main/java/org/apache/kafka/clients/consumer/internals/MembershipManagerImpl.java