RFR: 8149085: IntegrationTest1.java fails intermittently due to use of semi-initialized TLAB

Mikael Gerdin mikael.gerdin at oracle.com
Wed Jun 8 13:57:53 UTC 2016


On 2016-06-08 13:56, Erik Helin wrote:
> On 2016-05-24, Stefan Johansson wrote:
>> Hi,
>> Please review this fix for:
>> https://bugs.openjdk.java.net/browse/JDK-8149085
>> Webrev:
>> http://cr.openjdk.java.net/~sjohanss/8149085/hotspot.00/
> Looks reasonable, it is better than the current check. Reviewed.



> Thanks,
> Erik
>> Summary:
>> Thread::cooked_allocated_bytes() tries to give a good estimation of how much
>> has been allocated by a given thread. It does this by adding the stored
>> _allocated_bytes valued, incremented when a TLAB is retired, with the used
>> bytes from the currently active TLAB. This works fine when
>> cooked_allocated_bytes() is called by the current thread, but when called to
>> query a different thread there is a risk that the thread is in the middle of
>> retiring its TLAB. In such case there was risk that a bad used_bytes() value
>> was used and in turn caused the test in question to fail.
>> A similar issue seems to have been semi-fixed before, the removed code
>> suggests that making sure that the signed used bytes size is more than zero
>> is enough to make it a valid TLAB, but it turns out this is not enough.
>> Instead making sure that the used bytes value is less than the max allowed
>> TLAB-size should ensure that the TLAB has been fully initialized.
>> As the added comment suggests there is still a race present in this code,
>> and I don't intend to fix this now because I see this more as a fast
>> sampling function than something that we should rely on.
>> Testing:
>> Verified fix locally. RBT run for G1 and Parallel is ongoing.
>> Thanks,
>> Stefan

More information about the hotspot-gc-dev mailing list