Please review: 7146552 LoggingMXBeanTest intermittent failure
David Holmes
david.holmes at oracle.com
Mon Oct 15 03:09:26 UTC 2012
On 13/10/2012 2:55 AM, Jim Gish wrote:
> Please review
> http://cr.openjdk.java.net/~jgish/Bug7146552-LoggingMXBeanTest-failure/
> <http://cr.openjdk.java.net/%7Ejgish/Bug7146552-LoggingMXBeanTest-failure/>
>
> The LoggingMXBeanTest has been intermittently failing because garbage
> collection can cause the (weak) references to Logger instances to go
> away. LoggingMXBeanTest2 has the same issue, but no bug has (yet) been
> filed against it.
>
> The fix is to simply make the Logger variables static so they don't get
> gc'd.
Ouch! Most programmers would naively think that a local variable that is
still in scope is a strong ref! - not realizing that the JIT may reduce
its lifetime (or elide it completely) and so allow the logger to be
collected.
David
> Thanks,
> Jim
>
More information about the core-libs-dev
mailing list