You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "FrankYang0529 (via GitHub)" <gi...@apache.org> on 2025/01/22 01:14:31 UTC

[PR] KAFKA-18310: Flaky AbstractCoordinatorTest [kafka]

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

   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] https://github.com/apache/kafka/blob/3d49159c841e7653e3951af4ffc3524d17339295/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java#L480-L481
   [1] https://github.com/apache/kafka/blob/3d49159c841e7653e3951af4ffc3524d17339295/clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkClient.java#L230-L235
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18310: Flaky AbstractCoordinatorTest [kafka]

Posted by "lianetm (via GitHub)" <gi...@apache.org>.
lianetm closed pull request #18665: KAFKA-18310: Flaky AbstractCoordinatorTest
URL: https://github.com/apache/kafka/pull/18665


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18310: Flaky AbstractCoordinatorTest [kafka]

Posted by "kirktrue (via GitHub)" <gi...@apache.org>.
kirktrue commented on PR #18665:
URL: https://github.com/apache/kafka/pull/18665#issuecomment-2680067857

   Does #18945 supersede this PR, or do they solve different aspects of the problem?


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18310: Flaky AbstractCoordinatorTest [kafka]

Posted by "FrankYang0529 (via GitHub)" <gi...@apache.org>.
FrankYang0529 commented on PR #18665:
URL: https://github.com/apache/kafka/pull/18665#issuecomment-2680073988

   Yes, https://github.com/apache/kafka/pull/18945 supersede this PR. I will close this after https://github.com/apache/kafka/pull/18945 is merged.


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18310: Flaky AbstractCoordinatorTest [kafka]

Posted by "lianetm (via GitHub)" <gi...@apache.org>.
lianetm commented on PR #18665:
URL: https://github.com/apache/kafka/pull/18665#issuecomment-2711057382

   Closing this one now that https://github.com/apache/kafka/pull/18945 has been merged. Thanks!


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18310: Flaky AbstractCoordinatorTest [kafka]

Posted by "FrankYang0529 (via GitHub)" <gi...@apache.org>.
FrankYang0529 commented on PR #18665:
URL: https://github.com/apache/kafka/pull/18665#issuecomment-2660802650

   Hi @lianetm, thanks for taking a look. I think the `AbstractCoordinator#ensureActiveGroup` would like to finish `JoinGroupRequest` and `SyncGroupRequest`. However, there are two threads do poll. One is `AbstractCoordinator` and another is `HeartbeatThread`. After `AbstractCoordinator` gets `JoinGroupResponse`, it enables `HeartbeatThread` [0].  The `HeartbeatThread` does `pollNoWakeup` [1]. The `SyncGroupResponse` may be handled in `HeartbeatThread`, so we don't get `WackupException` as expected. This race condition makes flaky test.
   
   [0]
   https://github.com/apache/kafka/blob/e330f0bf2570a27811fa20a2f446b101a7a656f3/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java#L637-L660
   
   [1]
   https://github.com/apache/kafka/blob/e330f0bf2570a27811fa20a2f446b101a7a656f3/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java#L1479-L1501


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18310: Flaky AbstractCoordinatorTest [kafka]

Posted by "lianetm (via GitHub)" <gi...@apache.org>.
lianetm commented on PR #18665:
URL: https://github.com/apache/kafka/pull/18665#issuecomment-2659702572

   Hey @FrankYang0529 ! I was about to take a look at this flaky test as it's top of the flaky ones, and found you have a PR already, great! I will take a look next week to help push it through.  


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18310: Flaky AbstractCoordinatorTest [kafka]

Posted by "FrankYang0529 (via GitHub)" <gi...@apache.org>.
FrankYang0529 commented on PR #18665:
URL: https://github.com/apache/kafka/pull/18665#issuecomment-2680063332

   Hi @kirktrue, thanks, I have another PR try to mock HeartbeatThread. I think it can solve root cause, so we don't need to customize each case.
   
   https://github.com/apache/kafka/pull/18945


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org