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

Generating group ID in ZookeeperConsumerConnector shouldn't require local hostname to resolve

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Auto Closed
    • 0.8.1.1
    • None
    • None

    Description

      ZookeeperConsumerConnector generates group ID by taking the local hostname:

      consumerUuid = "%s-%d-%s".format(
      InetAddress.getLocalHost.getHostName, System.currentTimeMillis,
      uuid.getMostSignificantBits().toHexString.substring(0,8))

      If localhost doesn't resolve (something that happens occasionally), this will fail with following error:

      Exception in thread "main" java.net.UnknownHostException: Billc-cent70x64: Billc-cent70x64: Name or service not known
      at java.net.InetAddress.getLocalHost(InetAddress.java:1473)
      at kafka.consumer.ZookeeperConsumerConnector.<init>(ZookeeperConsumerConnector.scala:119)
      at kafka.consumer.ZookeeperConsumerConnector.<init>(ZookeeperConsumerConnector.scala:142)
      at kafka.consumer.Consumer$.create(ConsumerConnector.scala:89)
      at kafka.tools.ConsoleConsumer$.main(ConsoleConsumer.scala:149)
      at kafka.tools.ConsoleConsumer.main(ConsoleConsumer.scala)
      Caused by: java.net.UnknownHostException: Billc-cent70x64: Name or service not known
      at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
      at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
      at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
      at java.net.InetAddress.getLocalHost(InetAddress.java:1469)
      ... 5 more

      Normally requiring a resolving localhost is not a problem, but here is seems a bit frivolous - its just for generating an ID, nothing network related.

      I think we can catch the exception and generate an ID without the hostname.

      This is low priority since the issue can be easily worked around (add the hostname to /etc/hosts) and since this API is going away anyway with the new consumer API.

      Attachments

        1. KAFKA-1615.patch
          5 kB
          Jonathan Rafalski

        Issue Links

          Activity

            People

              gwenshap Gwen Shapira
              gwenshap Gwen Shapira
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: