RFR 8194929 : Unreferenced FileDescriptors not closed

Roger Riggs Roger.Riggs at Oracle.com
Thu Jan 11 16:37:04 UTC 2018

Hi  Alan,

On 1/11/2018 11:14 AM, Alan Bateman wrote:
> On 11/01/2018 15:19, Roger Riggs wrote:
>> Please review a fix for a missing entry in the mapfiles.  The missing 
>> entry point
>> caused the closing of unreferenced FileDescriptors to be skipped.
> Looks good.
>> The tests for FileInputStream, FileOutputStream, and RandomAccess 
>> file unreferenced
>> FileDescriptors have been updated to verify the raw fds have been 
>> closed.
> closeCounter is incremented before super.close(). That is good enough 
> for the original test as it's just checking that close is called. I'm 
> just wondering if the test methods now need to poll 
> FileDescriptor::valid or wait until ffd is -1 to ensure to avoid a 
> race with the getOpenFileDescriptorCount.
Holding a reference to the FileDescriptor would prevent it from being 
reclaimed and the test would never complete.

Each test waits until the Cleanup object has been reclaimed; if it has 
been reclaimed then
the closeCleanup0 has already been called to close the raw fd.

Thanks, Roger

More information about the core-libs-dev mailing list