FULL PRODUCT VERSION :
on Linux
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
on Windows
java version "1.8.0_66"
Java(TM) SE Ru
FULL OS VERSION :
Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u1 x86_64 GNU/Linux
and also
Windows 7 Professional ServicePack 1 64Bit
A DESCRIPTION OF THE PROBLEM :
If a Programm opens a lot of streams of resources without closing it, the GC sometimes does not clean those streams up.
This seems to lead to a lot of memory consuption (off heap) that will lead to programm death.
I am tracing server problems for a long time now and this might be the reason for issues where server just get slow at some point without any special hint.
Unfortunately left open streams occur in a lot of libraries around.
One of them is apache abdera which led me to this issue.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. create a jar file "test2.jar" containing a folder called test2 and a text file called test within that folder.
test2/test
Add a single line of random text to the file.
2. Run the programm specified under testcase with the jar file in the classpath
java/bin/java -Xmx512m -Xms256m -cp .:./test2.jar AbderaTest2
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected: java GC cleans up at some point and frees the memory
Actual: java uses up all the memory available on the system and the prgrmm crashes.
I tested this on a mashine with 16gb of ram.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
not available.
On linux the kernel kills the jvm at some point.
On windows the os also kills the process at some point.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;
public class AbderaTest2 {
public static void main(String[] args) throws IOException {
for (int i = 0; i < 10000000; i++) {
Enumeration<URL> e = Thread.currentThread().getContextClassLoader().getResources("test2/test");
while (e.hasMoreElements()) {
e.nextElement().openStream();
}
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Does not chrash if only the following command line is used
java/bin/java -Xmx512m -cp .:./test2.jar AbderaTest2
on Linux
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
on Windows
java version "1.8.0_66"
Java(TM) SE Ru
FULL OS VERSION :
Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u1 x86_64 GNU/Linux
and also
Windows 7 Professional ServicePack 1 64Bit
A DESCRIPTION OF THE PROBLEM :
If a Programm opens a lot of streams of resources without closing it, the GC sometimes does not clean those streams up.
This seems to lead to a lot of memory consuption (off heap) that will lead to programm death.
I am tracing server problems for a long time now and this might be the reason for issues where server just get slow at some point without any special hint.
Unfortunately left open streams occur in a lot of libraries around.
One of them is apache abdera which led me to this issue.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. create a jar file "test2.jar" containing a folder called test2 and a text file called test within that folder.
test2/test
Add a single line of random text to the file.
2. Run the programm specified under testcase with the jar file in the classpath
java/bin/java -Xmx512m -Xms256m -cp .:./test2.jar AbderaTest2
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected: java GC cleans up at some point and frees the memory
Actual: java uses up all the memory available on the system and the prgrmm crashes.
I tested this on a mashine with 16gb of ram.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
not available.
On linux the kernel kills the jvm at some point.
On windows the os also kills the process at some point.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;
public class AbderaTest2 {
public static void main(String[] args) throws IOException {
for (int i = 0; i < 10000000; i++) {
Enumeration<URL> e = Thread.currentThread().getContextClassLoader().getResources("test2/test");
while (e.hasMoreElements()) {
e.nextElement().openStream();
}
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Does not chrash if only the following command line is used
java/bin/java -Xmx512m -cp .:./test2.jar AbderaTest2