RFR: JDK-8014045 - test/java/lang/management/PlatformLoggingMXBean/LoggingMXBeanTest.java failing intermittently

Daniel Fuchs daniel.fuchs at oracle.com
Thu Jun 13 22:17:14 UTC 2013

On 6/13/13 10:05 PM, Mandy Chung wrote:
> Daniel,
> I wonder what the list of logger names (loggers1 and loggers2) 
> returned by LoggingMXBean contains and that may include loggers in the 
> running VM other than the ones created and kept a strong reference by 
> the test.   In other words,  would it be possible for the running VM 
> that has loggers that are not created by the test and got GC'ed?

That's exactly my suspicion. But since I haven't reproduced the issue 
it's impossible to say for sure.
I could try to print the list - maybe we would see if it already 
contains more than two loggers.

best regards,

-- daniel
> Mandy
> On 6/13/2013 6:47 AM, Daniel Fuchs wrote:
>> Hi,
>> Please find below an attempt at fixing
>> test/java/lang/management/PlatformLoggingMXBean/LoggingMXBeanTest.java
>> This is an intermittent failure which I haven't managed to reproduce,
>> so I am reduced to figure out what could have gone wrong by analyzing
>> the code.
>> AFAICT the NPE is thrown when LoggingMXBean.getLogerLevel(logger)
>> returns null - which I believe can only happen
>> when LogManager.getLogger() returns null.
>> I see that LogManager uses weak references to hold loggers - so my
>> suspicion is that one of the logger whose name had been returned by
>> getLoggerNames() has been gc'ed in between the two calls.
>> I have modified the code to accept this possibility - excluding the
>> two loggers for which the test itself holds a strong reference, as
>> these should not have been gc'ed.
>> I can't guarantee that it will fix the issue, but if it does not,
>> we will at least be able to disregard this possibility :-)
>> <http://cr.openjdk.java.net/~dfuchs/JDK-8014045/webrev.00/>
>> -- daniel

More information about the core-libs-dev mailing list