When too many FileInputStreams are created, runtime aborts with the
message "java.lang.NoClassDefFoundError". (Incidentally, since File.close()
is called from File.finalize(), IMHO it would be a Good Thing to have
File's constructor do a GC before giving up if there aren't enough file
descriptors, but that's tangential to this bug).
This bug can be triggerd by the following code:
public class foo {
public static void main(String args[]) {
try {
for (int i = 0; i < 1000; i++) {
java.io.FileInputStream s
= new java.io.FileInputStream("/etc/passwd");
}
} catch (Exception ex) {
System.out.println(ex);
}
System.out.println("Normal exit");
}
}
Running it produces:
(env.n) billf@jovial:~/tmp$ java foo
java.lang.NoClassDefFoundError
message "java.lang.NoClassDefFoundError". (Incidentally, since File.close()
is called from File.finalize(), IMHO it would be a Good Thing to have
File's constructor do a GC before giving up if there aren't enough file
descriptors, but that's tangential to this bug).
This bug can be triggerd by the following code:
public class foo {
public static void main(String args[]) {
try {
for (int i = 0; i < 1000; i++) {
java.io.FileInputStream s
= new java.io.FileInputStream("/etc/passwd");
}
} catch (Exception ex) {
System.out.println(ex);
}
System.out.println("Normal exit");
}
}
Running it produces:
(env.n) billf@jovial:~/tmp$ java foo
java.lang.NoClassDefFoundError
- duplicates
-
JDK-4027749 difficult to recover from running out of file descriptors
-
- Closed
-