RFR 8239893: Windows handle Leak when starting processes using ProcessBuilder
Brian Burkhalter
brian.burkhalter at oracle.com
Thu Mar 5 21:07:36 UTC 2020
Hi Roger,
> On Mar 5, 2020, at 12:51 PM, Roger Riggs <Roger.Riggs at oracle.com> wrote:
>
> Please review a change to the Windows ProcessImpl to ensure that the handles
> created for the input and output streams of a process are closed when no longer referenced.
>
> Unlike on Linux, there is no thread monitoring the process that can close the streams.
> The FileDescriptors are registered with the Cleaner to be closed when they are no longer referenced.
>
> A test is added that monitors the count of handles as 50 Processes are launched and exit.
> The test and change only affect the Windows implementation.
>
> Webrev:
> http://cr.openjdk.java.net/~rriggs/webrev-handles-8239893/ <http://cr.openjdk.java.net/~rriggs/webrev-handles-8239893/>
>
> Issue:
> https://bugs.openjdk.java.net/browse/JDK-8239893 <https://bugs.openjdk.java.net/browse/JDK-8239893>
In CheckHandles.java at line 72 there is this calculation:
final long ERROR_THRESHOLD = minHandles + (minHandles / ERROR_PERCENT); // 10% increase over min to passing max
Do you think it would be better as
final long ERROR_THRESHOLD = minHandles + ((minHandles + ERROR_PERCENT - 1) / ERROR_PERCENT); // 10% increase over min to passing max
, i.e., rounded instead of truncated?
Brian
More information about the core-libs-dev
mailing list