[ 
https://issues.apache.org/jira/browse/KAFKA-17464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18106686#comment-18106686
 ] 

Szymon Blumczynski commented on KAFKA-17464:
--------------------------------------------

Duplicate of KAFKA-18310, fixed by https://github.com/apache/kafka/pull/18945 
(commit 
[19d8a414ef|https://github.com/apache/kafka/commit/19d8a414ef6d86596d5f8d33828d8d7560cc8678],
 fix version 4.1.0). That ticket covered all three AbstractCoordinatorTest 
sync-group wakeup tests, including this one.

Cause: ensureActiveGroup() starts the real HeartbeatThread before 
joinGroupIfNeeded(). The heartbeat loop calls client.pollNoWakeup(), whose 
trySend() can transmit the queued SyncGroupRequest and MockClient.send() is 
where the test's RequestMatcher (and therefore consumerClient.wakeup()) runs. 
Because pollNoWakeup() passes disableWakeup=true, that thread sets the wakeup 
flag and completes the future without raising anything. The main thread sits in 
ConsumerNetworkClient.poll(future, timer), whose do/while only checks the flag 
inside poll(); seeing future.isDone() it exits without another iteration, so 
maybeTriggerWakeup() never runs and ensureActiveGroup() returns normally.

The fix extracted BaseHeartbeatThread and injects a Mockito mock in these 
tests, so the SyncGroup request is always sent by the main thread and the 
wakeup is observed deterministically. The test has carried no @Flaky annotation 
on trunk since then.

Hey [~apoorvmittal10], I believe we can close this one as it is a Duplicate of 
KAFKA-18310.

> Flaky test: 
> org.apache.kafka.clients.consumer.internals.AbstractCoordinatorTest.testWakeupAfterSyncGroupSentExternalCompletion
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-17464
>                 URL: https://issues.apache.org/jira/browse/KAFKA-17464
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Apoorv Mittal
>            Priority: Major
>         Attachments: test_result
>
>
> [https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-16956/5/testReport/org.apache.kafka.clients.consumer.internals/AbstractCoordinatorTest/Build___JDK_21_and_Scala_2_13___testWakeupAfterSyncGroupSentExternalCompletion__/]
>  
> {code:java}
> org.apache.kafka.clients.consumer.internals.AbstractCoordinatorTest.testWakeupAfterSyncGroupSentExternalCompletion()
> org.opentest4j.AssertionFailedError: Should have woken up from 
> ensureActiveGroup() ==> Expected 
> org.apache.kafka.common.errors.WakeupException to be thrown, but nothing was 
> thrown.
>       at 
> app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:152)
>       at 
> app//org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:73)
>       at 
> app//org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:39)
>       at 
> app//org.junit.jupiter.api.Assertions.assertThrows(Assertions.java:3131)
>       at 
> app//org.apache.kafka.clients.consumer.internals.AbstractCoordinatorTest.testWakeupAfterSyncGroupSentExternalCompletion(AbstractCoordinatorTest.java:1458)
>       at [email protected]/java.lang.reflect.Method.invoke(Method.java:580)
>       at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1596)
>       at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1596) 
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to