RFR 8078143: java/lang/management/ThreadMXBean/AllThreadIds.java fails intermittently

David Holmes david.holmes at oracle.com
Thu Apr 30 23:56:25 UTC 2015


Hi Jaroslav,

On 1/05/2015 12:25 AM, Jaroslav Bachorik wrote:
> Please, review the following test change
>
> Issue : https://bugs.openjdk.java.net/browse/JDK-8078143
> Webrev: http://cr.openjdk.java.net/~jbachorik/8078143/webrev.00
>
> The test fails intermittently due to inconsistent reporting of the live
> threads number.It is related to
> https://bugs.openjdk.java.net/browse/JDK-8021335 (or, better said,
> caused by) - certain performance counters used for the thread accounting
> are being updated under a mutex but are read without it - and it can
> lead to stale data being reported. More details are available in the
> linked issue and discussion.

Okay I just refreshed my memory on that - the fix is non-trivial 
unfortunately.

> Because of this it is not enough to join() a terminating thread to make
> sure the numbers would be correct.

Right.

> Luckily enough, it seems to be
> sufficient to wait for a short time before actually accessing the
> counters to be able to get a consistent view. In this fix I opted for a
> ridiculously huge interval of 500ms just to be sure.

It is a kludge but there's little else to be done without fixing 8021335.

So grudgingly Reviewed.

Thanks,
David


> Thanks,
>
> -JB-


More information about the serviceability-dev mailing list