RFR 9: 8146773 java/lang/ref/CleanerTest.java CleanerTest.testRefSubtypes() fails

Roger Riggs Roger.Riggs at Oracle.com
Mon Feb 1 14:47:02 UTC 2016

Hi Daniel,

On 2/1/2016 4:24 AM, Daniel Fuchs wrote:
> Hi Roger,
> Looks good to me - but I'd suggest to call fullGC at least once
> before waiting on the semaphore (e.g. add a call to whitebox.fullGC()
> when entering checkCleaned() before line 285).
> That might maximize the chances that the referred object will be
> GC'ed before you start waiting on the semaphore.
Sure, I moved the GC to the beginning of the loop
> Also I wonder whether you should raise the timeout in tryAcquire, 10ms
> is not much - and you want to give enough time so that the cleaner's
> thread is scheduled and calls the cleanup action...
> Maybe you could make that timeout depending on the timeoutFactor
> as well.
The number of cycles was scaled by the timeoutFactor but it is more 
intuitive to
scale the timeout itself.

checkCleaned is invoked for cases where the cleanup function will not be 
so increasing the timeout will just increase the running time of the test.
The refactoring was done to allow more time in cases where the cleaning 
is expected
and not wait too long in cases where it is not expected.  But the 
overall running time
of the test is < 10s.

Webrev updated in place.

Thanks, Roger

> best regards,
> -- daniel
> On 29/01/16 19:47, Roger Riggs wrote:
>> Please review a fix for two test issues. When run with -Xcomp and other
>> switches that change
>> GC behavior; the CleanerTest was not giving enough to time to see the
>> result of cleaning.
>> Also, added an adjustment of the number of cycles by the timeoutFactor.
>> Webrev:
>> http://cr.openjdk.java.net/~rriggs/webrev-cleanertest-8146773/
>> 8146773: java/lang/ref/CleanerTest.java CleanerTest.testRefSubtypes() 
>> fails
>> 8148352: CleanerTest fails: Cleanable should have been freed
>> Thanks, Roger

More information about the core-libs-dev mailing list