Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-16967

NioEchoServer fails to register connection and causes flaky failure

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 3.9.0
    • core

    Description

      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.

      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)

      This causes the test to fail with essentially a timeout, when the connection is expired for becoming idle unexpectedly:

      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)

      Instead, the NioEchoServer should handle exceptions from register in a similar fashion to the SocketServer.

      Attachments

        Issue Links

          Activity

            People

              frankvicky TengYao Chi
              gharris1727 Greg Harris
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: