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

NPE using SASL when following JavaSpec

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.6.0, 2.8.0
    • None
    • clients
    • None

    Description

      The Class "SaslChannelBuilder", the method "buildTransportLayer" is defined as follows (2.6.0):

      protected TransportLayer buildTransportLayer(String id, SelectionKey key, SocketChannel socketChannel,
                                                   ChannelMetadataRegistry metadataRegistry) throws IOException {
          if (this.securityProtocol == SecurityProtocol.SASL_SSL) {
              return SslTransportLayer.create(id, key,
                  sslFactory.createSslEngine(socketChannel.socket().getInetAddress().getHostName(),
                      socketChannel.socket().getPort()),
                  metadataRegistry);
          } else {
              return new PlaintextTransportLayer(key);
          }
      }

      When calling "getInetAddress()", the address is always available, because the Oracle Implementation of the "SocketChannel" class sets quite early the "remoteAddress" internally, even when the "isConnected" would return "false".

      Oracle seems to have created a bug, because following the specification of Java class "SocketChannel", the "remoteAddress" should be set internally only after the connection has been successfully built.

      Kafka follows the Oracle Implementation, NOT the java specification. Should this not be considered as bug in kafka?

       

       

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            JWalWein Walenwein
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: