UNIXProcess improvements

Martin Buchholz martinrb at google.com
Fri Apr 16 16:09:31 UTC 2010

I should have explicitly invited Michael and Xueming to review, as well.

On Fri, Apr 16, 2010 at 09:00, Chris Hegarty <chris.hegarty at oracle.com> wrote:
> Martin,
> I filed the following to track this:
>  6944584: Improvements to subprocess handling on Unix


> I took a look at the preliminary changes.
>  * I'm not sure we can remove any previous authors names.

We've considered doing that en masse.

I think it's only old copyrights that can never be removed.

>  * I assume the second part, buffering of data after process
>   termination has not been implemented yet, right?


> Otherwise look good.
> Michael:
>  You may want to take a look at these changes also.
> -Chris.
> Martin Buchholz wrote:
>> Chris and/or Alan,
>> I am planning some improvements to Process.
>> Please file a bug.
>> Synopsis: Improvements to subprocess handling on Unix
>> 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.
>> Preliminary fix here:
>> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/UNIXProcess/

More information about the core-libs-dev mailing list