RFR: 8156500: deadlock provoked by new stress test com/sun/jdi/OomDebugTest.java

Peter Levart peter.levart at gmail.com
Wed Aug 17 12:58:50 UTC 2016

Hi Kim,

On 08/15/2016 05:15 AM, Kim Barrett wrote:
>> >I have a feeling that these pauses are now unnecessary. Will try to check with some experiments…
> I found that the DirectBufferAllocTest will sometimes fail if the pauses are taken out.
> I think what’s going on is that the multiple threads are competing for resources, and
> some threads in that test lose out if all of them are waiting and wake up at the same
> time.  The exponentially increasing back-off scatters the threads enough for that to
> become very unlikely, though with sufficiently bad luck… But I think the current
> implementation could also fail that test with similarly bad luck.  It just requires*very*
> bad luck, so we’re not seeing it as a problem.  And that test is a pretty extreme stress
> test.

I get the same results when experimenting with this. Another option 
would be to enclose the whole logic of (retrying reservation while 
waiting for Reference processing progress followed by System.gc() and 
another round of reservation retries while waiting for Reference 
processing) into a synchronized block so that multiple reservation 
threads could not barge for reservations. This approach works and might 
even be triggering less System.gc() rounds, but it is not much better 
than current approach.

Regards, Peter

More information about the core-libs-dev mailing list