Bug mentioned below exists for all previous JDK releases and current Merlin release.
File handles are not getting freed up when a Process object is destroyed.
User needs to implement a close for each stream. It would be better
if destroy() method could close all streams for a given process.
Please see workaround on how to fix testcase to get around file handle issue.
This needs to be documented for Merlin in some way or fixed in future release.
Testcase below:
import java.io.IOException;
class FHT {
public static void main(String args[]) {
for (int i = 0; i < 4000; i++) {
try {
Process p = Runtime.getRuntime().exec("/bin/echo hello");
p.destroy();
}
catch(IOException x) {
System.err.println("Bogus IOException after " + i +
" invocations: " + x.getMessage());
return;
}
}
}
}
We need to close streams only if we have not given them out.
###@###.### 2002-06-24
File handles are not getting freed up when a Process object is destroyed.
User needs to implement a close for each stream. It would be better
if destroy() method could close all streams for a given process.
Please see workaround on how to fix testcase to get around file handle issue.
This needs to be documented for Merlin in some way or fixed in future release.
Testcase below:
import java.io.IOException;
class FHT {
public static void main(String args[]) {
for (int i = 0; i < 4000; i++) {
try {
Process p = Runtime.getRuntime().exec("/bin/echo hello");
p.destroy();
}
catch(IOException x) {
System.err.println("Bogus IOException after " + i +
" invocations: " + x.getMessage());
return;
}
}
}
}
We need to close streams only if we have not given them out.
###@###.### 2002-06-24
- relates to
-
JDK-4191034 (process) java.lang.Process.destroy() fails to free up file handles.
- Closed