Discussion:
RFR (S) 8048215: [TESTBUG] java/lang/management/ManagementFactory/ThreadMXBeanProxy.java Expected non-null LockInfo
David Holmes
2018-10-15 04:23:50 UTC
Permalink
bug: https://bugs.openjdk.java.net/browse/JDK-8048215
webrev: http://cr.openjdk.java.net/~dholmes/8048215/webrev/

Simple race condition in the test. The main thread does checks that are
only valid once the target thread has called o.wait() but there's
nothing to ensure that point of execution is reached. The failure is
easily reprodcued by just putting in a sleep after:

Object o = new Object();

Fix is to add a shared 'waiter' Object that the target waits upon and
for which the main also synchronizes on such that the main thread can't
proceed until wait() has been called and released the monitor.

Thanks,
David
Daniel Fuchs
2018-10-15 09:47:54 UTC
Permalink
Hi David,

Good finding! Looks reasonable to me.

best regards,

-- daniel
Post by David Holmes
bug: https://bugs.openjdk.java.net/browse/JDK-8048215
webrev: http://cr.openjdk.java.net/~dholmes/8048215/webrev/
Simple race condition in the test. The main thread does checks that are
only valid once the target thread has called o.wait() but there's
nothing to ensure that point of execution is reached. The failure is
Object o = new Object();
Fix is to add a shared 'waiter' Object that the target waits upon and
for which the main also synchronizes on such that the main thread can't
proceed until wait() has been called and released the monitor.
Thanks,
David
David Holmes
2018-10-15 11:55:11 UTC
Permalink
Thanks for the review Daniel!

David
Post by Daniel Fuchs
Hi David,
Good finding! Looks reasonable to me.
best regards,
-- daniel
Post by David Holmes
bug: https://bugs.openjdk.java.net/browse/JDK-8048215
webrev: http://cr.openjdk.java.net/~dholmes/8048215/webrev/
Simple race condition in the test. The main thread does checks that
are only valid once the target thread has called o.wait() but there's
nothing to ensure that point of execution is reached. The failure is
Object o = new Object();
Fix is to add a shared 'waiter' Object that the target waits upon and
for which the main also synchronizes on such that the main thread
can't proceed until wait() has been called and released the monitor.
Thanks,
David
JC Beyler
2018-10-15 15:10:55 UTC
Permalink
Hi David,

Looks good to me as well,
Jc
Post by David Holmes
Thanks for the review Daniel!
David
Post by Daniel Fuchs
Hi David,
Good finding! Looks reasonable to me.
best regards,
-- daniel
Post by David Holmes
bug: https://bugs.openjdk.java.net/browse/JDK-8048215
webrev: http://cr.openjdk.java.net/~dholmes/8048215/webrev/
Simple race condition in the test. The main thread does checks that
are only valid once the target thread has called o.wait() but there's
nothing to ensure that point of execution is reached. The failure is
Object o = new Object();
Fix is to add a shared 'waiter' Object that the target waits upon and
for which the main also synchronizes on such that the main thread
can't proceed until wait() has been called and released the monitor.
Thanks,
David
--
Thanks,
Jc
David Holmes
2018-10-15 19:59:33 UTC
Permalink
Thanks Jc!

David
Post by Daniel Fuchs
Hi David,
Looks good to me as well,
Jc
Thanks for the review Daniel!
David
Post by Daniel Fuchs
Hi David,
Good finding! Looks reasonable to me.
best regards,
-- daniel
Post by David Holmes
bug: https://bugs.openjdk.java.net/browse/JDK-8048215
webrev: http://cr.openjdk.java.net/~dholmes/8048215/webrev/
<http://cr.openjdk.java.net/%7Edholmes/8048215/webrev/>
Post by Daniel Fuchs
Post by David Holmes
Simple race condition in the test. The main thread does checks that
are only valid once the target thread has called o.wait() but
there's
Post by Daniel Fuchs
Post by David Holmes
nothing to ensure that point of execution is reached. The
failure is
Post by Daniel Fuchs
Post by David Holmes
Object o = new Object();
Fix is to add a shared 'waiter' Object that the target waits
upon and
Post by Daniel Fuchs
Post by David Holmes
for which the main also synchronizes on such that the main thread
can't proceed until wait() has been called and released the monitor.
Thanks,
David
--
Thanks,
Jc
Mandy Chung
2018-10-15 17:09:31 UTC
Permalink
Post by David Holmes
bug: https://bugs.openjdk.java.net/browse/JDK-8048215
webrev: http://cr.openjdk.java.net/~dholmes/8048215/webrev/
Simple race condition in the test. The main thread does checks that
are only valid once the target thread has called o.wait() but there's
nothing to ensure that point of execution is reached. The failure is
Object o = new Object();
Fix is to add a shared 'waiter' Object that the target waits upon and
for which the main also synchronizes on such that the main thread
can't proceed until wait() has been called and released the monitor.
Thanks for fixing this.  It's good finds.  This looks good.

I wonder if some other ThreadMXBean tests have similiar bug.

Mandy
David Holmes
2018-10-15 20:00:02 UTC
Permalink
Thanks for the review Mandy!

David
Post by David Holmes
bug: https://bugs.openjdk.java.net/browse/JDK-8048215
webrev: http://cr.openjdk.java.net/~dholmes/8048215/webrev/
Simple race condition in the test. The main thread does checks that
are only valid once the target thread has called o.wait() but there's
nothing to ensure that point of execution is reached. The failure is
Object o = new Object();
Fix is to add a shared 'waiter' Object that the target waits upon and
for which the main also synchronizes on such that the main thread
can't proceed until wait() has been called and released the monitor.
Thanks for fixing this.  It's good finds.  This looks good.
I wonder if some other ThreadMXBean tests have similiar bug.
Mandy
Loading...