RFR: 8066952 [TEST-BUG] javax/management/monitor/CounterMonitorTest.java hangs
shanliang
shanliang.jiang at oracle.com
Fri Dec 12 12:44:10 UTC 2014
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.
bug: https://bugs.openjdk.java.net/browse/JDK-8066952
webrev: http://cr.openjdk.java.net/~sjiang/JDK-8066952/00/
Thanks,
Shanliang
More information about the serviceability-dev
mailing list