Cassandra requires hostname is resolvable even when specifying IP's for listen 
and rpc addresses
------------------------------------------------------------------------------------------------

                 Key: CASSANDRA-2380
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2380
             Project: Cassandra
          Issue Type: Bug
          Components: Core
    Affects Versions: 0.7.4
         Environment: open jdk 1.6.0_20 64-Bit 
            Reporter: Eric Tamme
            Priority: Trivial


A strange looking error is printed out, with no stack trace and no other log, 
when hostname is not resolvable regardless of whether or not the hostname is 
being used to specify a listen or rpc address.  I am specifically using IPv6 
addresses but I have tested it with IPv4 and gotten the same result.

Error: Exception thrown by the agent : java.net.MalformedURLException: Local 
host name unknown: java.net.UnknownHostException

I have spent several hours trying to track down what is happening and have been 
unable to determine if this is down in the java 
getByName->getAllByName->getAllByName0 set of methods that is happening when  

listenAddress = InetAddress.getByName(conf.listen_address);

is called from DatabaseDescriptor.java

I am not able to replicate the error in a stand alone java program (see below) 
so I am not sure what cassandra is doing to force name resolution.  Perhaps the 
issue is not in DatabaseDescriptor, but some where else?  I get no log output, 
and no stack trace when this happens, only the single line error.

import java.net.InetAddress;
import java.net.UnknownHostException;

class Test
{
    public static void main(String args[])
    {
        try
        {
            InetAddress listenAddress = InetAddress.getByName("foo");
            System.out.println(listenAddress);
        }
        catch (UnknownHostException e)
        {
            System.out.println("Unable to parse address");
        }

    }
}


People have just said "oh go put a line in your hosts file" and while that does 
work, it is not right.  If I am not using my hostname for any reason cassandra 
should not have to resolve it, and carrying around that application specific 
stuff in your hosts file is not correct.

Regardless of if this bug gets fixed, I want to better understand what the heck 
is going on that makes cassandra crash and print out that exception.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to