From InetAddress.java:
} finally {
// Cache the address.
cacheAddress(host, obj, success);
// Delete the host from the lookupTable, and
// notify all threads waiting for the monitor
// for lookupTable.
updateLookupTable(host);
}
If cacheAddress() throws an exception, such as OutOfMemoryError,
then updateLookupTable() will not get called. This will
cause future lookups of this host to wait forever in
checkLookupTable().
###@###.### 2005-05-27 00:30:53 GMT
A test case follows:
----
import java.net.InetAddress;
import java.net.UnknownHostException;
public class test2 {
public static void main(String args[]) {
System.setProperty("sun.simulate.outofmemory", "true");
try {
InetAddress.getByName("localhost");
} catch (Exception e) {
}
System.setProperty("sun.simulate.outofmemory", "false");
try {
InetAddress.getByName("localhost");
} catch (Exception e) {
}
}
}
----
Because the out-of-memory error needs to happen in a very specific
place, the easiest way to reproduce the problem is either to
modify cacheAddress() in InetAddress.java to do something like:
if (System.getProperty("sun.simulate.outofmemory").equals("true")) {
throw new RuntimeException("Out of memory");
}
or run inside a debugger and force an out-of-memory error at
the correct time.
###@###.### 2005-06-16 07:01:27 GMT
} finally {
// Cache the address.
cacheAddress(host, obj, success);
// Delete the host from the lookupTable, and
// notify all threads waiting for the monitor
// for lookupTable.
updateLookupTable(host);
}
If cacheAddress() throws an exception, such as OutOfMemoryError,
then updateLookupTable() will not get called. This will
cause future lookups of this host to wait forever in
checkLookupTable().
###@###.### 2005-05-27 00:30:53 GMT
A test case follows:
----
import java.net.InetAddress;
import java.net.UnknownHostException;
public class test2 {
public static void main(String args[]) {
System.setProperty("sun.simulate.outofmemory", "true");
try {
InetAddress.getByName("localhost");
} catch (Exception e) {
}
System.setProperty("sun.simulate.outofmemory", "false");
try {
InetAddress.getByName("localhost");
} catch (Exception e) {
}
}
}
----
Because the out-of-memory error needs to happen in a very specific
place, the easiest way to reproduce the problem is either to
modify cacheAddress() in InetAddress.java to do something like:
if (System.getProperty("sun.simulate.outofmemory").equals("true")) {
throw new RuntimeException("Out of memory");
}
or run inside a debugger and force an out-of-memory error at
the correct time.
###@###.### 2005-06-16 07:01:27 GMT
- duplicates
-
JDK-7012768 InetAddress lookupTable leaks/deadlocks when using unsupported name service spi
-
- Closed
-