JDK-6944584 : Improvements to subprocess handling on Unix
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2010-04-16
  • Updated: 2019-03-02
  • Resolved: 2011-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b100Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Looking at UNIXProcess.java.linux, there are a number of possible improvements:

The "process reaper" thread should run in a thread pool to save on
thread creation in case of repeated process creation.  Its stack size
should be small.

If the process reaper thread throws a non-IOException (e.g. OOME)
the thread creating the subprocess will hang,
waiting for a signal from the reaper thread.

The JDK knows when the subprocess terminates.
At that time, we cannot yet close the streams,
because there may still be unread buffered data, but...
the file descriptors underlying the subprocess streams
can be drained, then closed, and the drained bytes can
be added to the internal buffer.  This will solve most cases
of (pandemic) poor file stream hygiene leading to
file descriptor exhaustion or simply poor performance.

Comments
EVALUATION JDK7 changeset: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/422531c98ba5
23-06-2010