This bug is reported by Dan McDonald.
If there are multiple IPv6 addresses for a node, InetAddress will hang inside LookupAllHostAddr function in Inet6AddressImpl.c.
Here is the stack trace:
^\Full thread dump:
"Signal Dispatcher" daemon prio=10 tid=0xa0cd0 nid=0x7 waiting on monitor [0..0]
"Finalizer" daemon prio=8 tid=0x9da98 nid=0x4 waiting on monitor [faf7f000..faf7fc68]
at java.lang.Object.wait(Native Method)
- waiting on <f4c004c8> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
- locked <f4c004c8> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:126)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:162)
"Reference Handler" daemon prio=10 tid=0x9c240 nid=0x3 waiting on monitor [fd17f000..fd17fc68]
at java.lang.Object.wait(Native Method)
- waiting on <f4c003d0> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:425)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:110)
- locked <f4c003d0> (a java.lang.ref.Reference$Lock)
"main" prio=5 tid=0x29130 nid=0x1 runnable [ffbfe000..ffbfef5c]
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:591)
at java.net.InetAddress.getAddressFromNameService(InetAddress.java:819)
at java.net.InetAddress.getAllByName0(InetAddress.java:775)
at java.net.InetAddress.getAllByName0(InetAddress.java:748)
at java.net.InetAddress.getAllByName(InetAddress.java:742)
at GetIP.main(GetIP.java:10)
"VM Thread" prio=5 tid=0x9af08 nid=0x2 runnable
"VM Periodic Task Thread" prio=10 tid=0x9fb00 nid=0x5 waiting on
"Suspend Checker Thread" prio=10 tid=0xa03e8 nid=0x6 runnable
When using this test case:
import java.net.*;
import java.io.*;
public class GetIP {
public static void main(String[] arg)
{
try {
InetAddress[] iadr = InetAddress.getAllByName(arg[0]);
System.out.println("iadr length " + iadr.length);
for(int i=0; i< iadr.length; i++)
{
System.out.println("ip address : " + iadr[i].getHostAddress());
System.out.println(" Host Name :" + iadr[i].getHostName());
//System.out.println("family " + iadr[i].getFamily());
System.out.println("Host aadd byte arr " + iadr[i].getAddress());
if(iadr[i] instanceof Inet4Address)
System.out.println("v4 address");
if(iadr[i] instanceof Inet6Address)
System.out.println("v6 address ");
} catch(Exception exp) {
exp.printStackTrace();
System.out.println("exp mesg " + exp.getMessage());
}
} // End of main
}
If there are multiple IPv6 addresses for a node, InetAddress will hang inside LookupAllHostAddr function in Inet6AddressImpl.c.
Here is the stack trace:
^\Full thread dump:
"Signal Dispatcher" daemon prio=10 tid=0xa0cd0 nid=0x7 waiting on monitor [0..0]
"Finalizer" daemon prio=8 tid=0x9da98 nid=0x4 waiting on monitor [faf7f000..faf7fc68]
at java.lang.Object.wait(Native Method)
- waiting on <f4c004c8> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
- locked <f4c004c8> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:126)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:162)
"Reference Handler" daemon prio=10 tid=0x9c240 nid=0x3 waiting on monitor [fd17f000..fd17fc68]
at java.lang.Object.wait(Native Method)
- waiting on <f4c003d0> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:425)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:110)
- locked <f4c003d0> (a java.lang.ref.Reference$Lock)
"main" prio=5 tid=0x29130 nid=0x1 runnable [ffbfe000..ffbfef5c]
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:591)
at java.net.InetAddress.getAddressFromNameService(InetAddress.java:819)
at java.net.InetAddress.getAllByName0(InetAddress.java:775)
at java.net.InetAddress.getAllByName0(InetAddress.java:748)
at java.net.InetAddress.getAllByName(InetAddress.java:742)
at GetIP.main(GetIP.java:10)
"VM Thread" prio=5 tid=0x9af08 nid=0x2 runnable
"VM Periodic Task Thread" prio=10 tid=0x9fb00 nid=0x5 waiting on
"Suspend Checker Thread" prio=10 tid=0xa03e8 nid=0x6 runnable
When using this test case:
import java.net.*;
import java.io.*;
public class GetIP {
public static void main(String[] arg)
{
try {
InetAddress[] iadr = InetAddress.getAllByName(arg[0]);
System.out.println("iadr length " + iadr.length);
for(int i=0; i< iadr.length; i++)
{
System.out.println("ip address : " + iadr[i].getHostAddress());
System.out.println(" Host Name :" + iadr[i].getHostName());
//System.out.println("family " + iadr[i].getFamily());
System.out.println("Host aadd byte arr " + iadr[i].getAddress());
if(iadr[i] instanceof Inet4Address)
System.out.println("v4 address");
if(iadr[i] instanceof Inet6Address)
System.out.println("v6 address ");
} catch(Exception exp) {
exp.printStackTrace();
System.out.println("exp mesg " + exp.getMessage());
}
} // End of main
}