You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "bboyleonp (Jira)" <ji...@apache.org> on 2024/07/25 12:12:00 UTC

[jira] [Comment Edited] (KAFKA-16701) Some SocketServerTest buffered close tests flaky failing locally

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

bboyleonp edited comment on KAFKA-16701 at 7/25/24 12:11 PM:
-------------------------------------------------------------

Hi [~gharris1727],
This issue seems to occur when the UTs are executed simultaneously by the following command
{code:java}
./gradlew :core:unitTest --tests "kafka.network.SocketServerTest" {code}
 

and they will pass when executed separately under JDK 17 if I do
{code:java}
./gradlew :core:unitTest --tests "kafka.network.SocketServerTest.closingChannelSendFailure" {code}
 

I found that the UT execution before `closingChannelSendFailure` is `processDisconnectedException` for both JDK 11 and 17. However, the execution of `processDisconnectedException` will finish execution under JDK 11, then do the `closingChannelSendFailure`, which in JDK 17 is not that case. After starting `processDisconnectedException` under JDK 17, `closingChannelSendFailure` will start its execution in the middle of `processDisconnectedException` and causes the following error that is not seen under JDK 11.
{code:java}
[2024-07-25 19:33:24,435] ERROR Exception while processing disconnection of notAValidConnectionId (kafka.network.SocketServerTest$TestableProcessor:76)java.lang.IllegalStateException: connectionId has unexpected format: notAValidConnectionId	at kafka.network.Processor.$anonfun$processDisconnected$3(SocketServer.scala:1218)	at scala.Option.getOrElse(Option.scala:201)	at kafka.network.Processor.$anonfun$processDisconnected$1(SocketServer.scala:1218)	at java.base/java.util.HashMap$KeySet.forEach(HashMap.java:1008)	at kafka.network.Processor.processDisconnected(SocketServer.scala:1214)	at kafka.network.Processor.run(SocketServer.scala:1017)	at java.base/java.lang.Thread.run(Thread.java:840) {code}
It seems there's a race condition between these unit tests. I am a little confused now. Aren't the unit tests supposed to be executed separately? Did I miss something?


was (Author: JIRAUSER305190):
Hi [~gharris1727],
This issue seems to occur when the UTs are executed simultaneously by the following command
{code:java}
./gradlew :core:unitTest --tests "kafka.network.SocketServerTest" {code}
and they will pass when executed separately under JDK 17 if I do

 
{code:java}
./gradlew :core:unitTest --tests "kafka.network.SocketServerTest.closingChannelSendFailure" {code}
 


I found that the UT execution before `closingChannelSendFailure` is `processDisconnectedException` for both JDK 11 and 17. However, the execution of `processDisconnectedException` will finish execution under JDK 11, then do the `closingChannelSendFailure`, which in JDK 17 is not that case. After starting `processDisconnectedException` under JDK 17, `closingChannelSendFailure` will start its execution in the middle of `processDisconnectedException` and causes the following error that is not seen under JDK 11.
{code:java}
[2024-07-25 19:33:24,435] ERROR Exception while processing disconnection of notAValidConnectionId (kafka.network.SocketServerTest$TestableProcessor:76)java.lang.IllegalStateException: connectionId has unexpected format: notAValidConnectionId	at kafka.network.Processor.$anonfun$processDisconnected$3(SocketServer.scala:1218)	at scala.Option.getOrElse(Option.scala:201)	at kafka.network.Processor.$anonfun$processDisconnected$1(SocketServer.scala:1218)	at java.base/java.util.HashMap$KeySet.forEach(HashMap.java:1008)	at kafka.network.Processor.processDisconnected(SocketServer.scala:1214)	at kafka.network.Processor.run(SocketServer.scala:1017)	at java.base/java.lang.Thread.run(Thread.java:840) {code}
It seems there's a race condition between these unit tests. I am a little confused now. Aren't the unit tests supposed to be executed separately? Did I miss something?

> Some SocketServerTest buffered close tests flaky failing locally
> ----------------------------------------------------------------
>
>                 Key: KAFKA-16701
>                 URL: https://issues.apache.org/jira/browse/KAFKA-16701
>             Project: Kafka
>          Issue Type: Test
>          Components: core, unit tests
>    Affects Versions: 3.5.0, 3.6.0, 3.7.0
>            Reporter: Greg Harris
>            Assignee: bboyleonp
>            Priority: Major
>              Labels: flaky-test
>
> These tests are failing for me on a local development environment, but don't appear to be flaky or failing in CI. They only appear to fail for JDK >= 17. I'm using an M1 Mac, so it is possible that either the Mac's linear port allocation, or a native implementation is impacting this.
> closingChannelSendFailure()
>  
> {noformat}
> java.lang.AssertionError: receiveRequest timed out
> 	at kafka.network.SocketServerTest.receiveRequest(SocketServerTest.scala:148)
> 	at kafka.network.SocketServerTest.makeChannelWithBufferedRequestsAndCloseRemote(SocketServerTest.scala:690)
> 	at kafka.network.SocketServerTest.$anonfun$verifySendFailureAfterRemoteClose$1(SocketServerTest.scala:1434)
> 	at kafka.network.SocketServerTest.verifySendFailureAfterRemoteClose(SocketServerTest.scala:1430)
> 	at kafka.network.SocketServerTest.closingChannelSendFailure(SocketServerTest.scala:1425){noformat}
> closingChannelWithBufferedReceivesFailedSend()
>  
> {noformat}
> java.lang.AssertionError: receiveRequest timed out
> 	at kafka.network.SocketServerTest.receiveRequest(SocketServerTest.scala:148)
> 	at kafka.network.SocketServerTest.$anonfun$verifyRemoteCloseWithBufferedReceives$6(SocketServerTest.scala:1591)
> 	at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:190)
> 	at kafka.network.SocketServerTest.$anonfun$verifyRemoteCloseWithBufferedReceives$1(SocketServerTest.scala:1590)
> 	at kafka.network.SocketServerTest.verifyRemoteCloseWithBufferedReceives(SocketServerTest.scala:1553)
> 	at kafka.network.SocketServerTest.closingChannelWithBufferedReceivesFailedSend(SocketServerTest.scala:1520){noformat}
> closingChannelWithCompleteAndIncompleteBufferedReceives()
> {noformat}
> java.lang.AssertionError: receiveRequest timed out
> 	at kafka.network.SocketServerTest.receiveRequest(SocketServerTest.scala:148)
> 	at kafka.network.SocketServerTest.$anonfun$verifyRemoteCloseWithBufferedReceives$6(SocketServerTest.scala:1591)
> 	at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:190)
> 	at kafka.network.SocketServerTest.$anonfun$verifyRemoteCloseWithBufferedReceives$1(SocketServerTest.scala:1590)
> 	at kafka.network.SocketServerTest.verifyRemoteCloseWithBufferedReceives(SocketServerTest.scala:1553)
> 	at kafka.network.SocketServerTest.closingChannelWithCompleteAndIncompleteBufferedReceives(SocketServerTest.scala:1511) {noformat}
> remoteCloseWithBufferedReceives()
> {noformat}
> java.lang.AssertionError: receiveRequest timed out
> 	at kafka.network.SocketServerTest.receiveRequest(SocketServerTest.scala:148)
> 	at kafka.network.SocketServerTest.$anonfun$verifyRemoteCloseWithBufferedReceives$6(SocketServerTest.scala:1591)
> 	at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:190)
> 	at kafka.network.SocketServerTest.$anonfun$verifyRemoteCloseWithBufferedReceives$1(SocketServerTest.scala:1590)
> 	at kafka.network.SocketServerTest.verifyRemoteCloseWithBufferedReceives(SocketServerTest.scala:1553)
> 	at kafka.network.SocketServerTest.remoteCloseWithBufferedReceives(SocketServerTest.scala:1453){noformat}



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