Gwen Shapira created KAFKA-1615:
-----------------------------------

             Summary: Generating group ID in ZookeeperConsumerConnector 
shouldn't require local hostname to resolve
                 Key: KAFKA-1615
                 URL: https://issues.apache.org/jira/browse/KAFKA-1615
             Project: Kafka
          Issue Type: Bug
    Affects Versions: 0.8.1.1
            Reporter: Gwen Shapira
            Assignee: Gwen Shapira
            Priority: Minor


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.  




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to