Uploaded image for project: 'Apache Cassandra'
  1. Apache Cassandra
  2. CASSANDRA-2380

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Low
    • Resolution: Cannot Reproduce
    • None
    • None
    • None
    • open jdk 1.6.0_20 64-Bit

    • Low

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            etamme Eric Tamme
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: