[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-serviceability-dev
Subject:    Re: RFR: 8066952 [TEST-BUG] javax/management/monitor/CounterMonitorTest.java hangs
From:       Daniel Fuchs <daniel.fuchs () oracle ! com>
Date:       2014-12-12 13:05:32
Message-ID: 548AE81C.5040405 () oracle ! com
[Download RAW message or body]

On 12/12/14 13:44, shanliang wrote:
> Hi,
>
> As Daniel said: "I think that what happens here is that the
> StdObservedObject.getNbObjects() getter unblocks the main thread before
> returning the value to the monitor. This makes it possible to have a
> race condition where the next setNbObjects called by the main thread can
> then occur before the result of StdObservedObject.getNbObjects() is
> taken into account - and even before the
> StdObservedObject.getNbObjects() actually returns. So
> StdObservedObject.getNbObjects() may return a value different than the
> one which was observed. In our case, it would return 3 (the newer value)
> instead of 0 (the value that was observed). "
>
> The suggested fix is to return "observedValue" instead of "count", in
> this way we check also that the monitor never starts next observation
> before the current one finishes.

Looks good Shanliang!

-- daniel

>
> bug: https://bugs.openjdk.java.net/browse/JDK-8066952
> webrev: http://cr.openjdk.java.net/~sjiang/JDK-8066952/00/
>
> Thanks,
> Shanliang

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic