[ https://issues.apache.org/jira/browse/KAFKA-1615?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14323165#comment-14323165 ]
Jonathan Rafalski commented on KAFKA-1615: ------------------------------------------ [~gwenshap], I would like to start working on this issue as I am new to kafka and wanted to start working through the code. My question is, if they hostname is unable to be resolved do we want to default the hostname to "UNRESOVLED" or "Consumer" (or other generic string) so that we still maintain the ID format of NAME-TIME-UUID or do we want to remove it completely in these cases and just generate TIME-UUID as the ID? Also so that we aren't just suppressing the error we should throw it out to the log. My gut says the warn wrapper should be used as an unresolved host may cause issues down the line but wanted to make sure since I am new. > 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 > Labels: newbie, usability > > 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.3.4#6332)