Greg Harris created KAFKA-16967: ----------------------------------- Summary: NioEchoServer fails to register connection and causes flaky failure Key: KAFKA-16967 URL: https://issues.apache.org/jira/browse/KAFKA-16967 Project: Kafka Issue Type: Task Components: core Reporter: Greg Harris
The NioEchoServer calls Selector#register for new connections. This call can throw exceptions, which then kill the NioEchoServer. This has been observed in the SslTransportLayerTest testUngracefulRemoteCloseDuringHandshake* methods. {noformat} Exception in thread "echoserver" java.lang.IllegalStateException: There is already a connection for id 127.0.0.1:40007-127.0.0.1:43710 at org.apache.kafka.common.network.Selector.ensureNotRegistered(Selector.java:322) at org.apache.kafka.common.network.Selector.register(Selector.java:310) at org.apache.kafka.common.network.NioEchoServer.run(NioEchoServer.java:229){noformat} This causes the test to fail with essentially a timeout, when the connection is expired for becoming idle unexpectedly: {noformat} org.opentest4j.AssertionFailedError: Unexpected channel state EXPIRED ==> expected: <true> but was: <false> at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151) at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132) at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63) at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36) at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:214) at org.apache.kafka.common.network.SslTransportLayerTest.testIOExceptionsDuringHandshake(SslTransportLayerTest.java:898) at org.apache.kafka.common.network.SslTransportLayerTest.testUngracefulRemoteCloseDuringHandshakeRead(SslTransportLayerTest.java:837){noformat} Instead, the NioEchoServer should handle exceptions from register in a similar fashion to the SocketServer. -- This message was sent by Atlassian Jira (v8.20.10#820010)