Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-18310: Flaky AbstractCoordinatorTest #18665

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

FrankYang0529
Copy link
Member

The AbstractCoordinator#joinGroupIfNeeded calls ConsumerNetworkClient#poll(RequestFuture, Timer) [0]. It calls another method with disableWakeup = false. If joinFuture is not done, ConsumerNetworkClient does poll multiple times before timer is expired [1]. If joinFuture finishes too fast, the SyncGroupRequest can't be handled in AbstractCoordinator#ensureActiveGroup, so it doesn't throw WakeupException. Change ConsumerNetworkClient#poll(RequestFuture, Timer, boolean) like following in the trunk branch and the flaky cases can be reproduced frequently.

public boolean poll(RequestFuture<?> future, Timer timer, boolean disableWakeup) {
    do {
        poll(timer, future, disableWakeup);
        try {
            System.err.println("sleeping.....");
            Thread.sleep(1000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    } while (!future.isDone() && timer.notExpired());
    return future.isDone();
}

[0]

final RequestFuture<ByteBuffer> future = initiateJoinGroup();
client.poll(future, timer);

[1]
public boolean poll(RequestFuture<?> future, Timer timer, boolean disableWakeup) {
do {
poll(timer, future, disableWakeup);
} while (!future.isDone() && timer.notExpired());
return future.isDone();
}

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@github-actions github-actions bot added consumer tests Test fixes (including flaky tests) clients small Small PRs labels Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clients consumer small Small PRs tests Test fixes (including flaky tests)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant