RFR(S) 8021335: Missing synchronization when reading counters for live threads and peak thread count

JC Beyler jcbeyler at google.com
Tue Oct 16 17:28:40 UTC 2018


Hi Dean,

I noticed a typo here :
"are atomically" is in the comment but should no longer be there I believe;
the sentence probably should be:
// These 2 counters are like the above thread counts, but are

Any way we could move this test into a helper method and both
add_thread/current_thread_exiting
could use the same "ignore" thread code so that we ensure the two never get
out of sync?

+  if (jt->is_hidden_from_external_view() ||
+      jt->is_jvmti_agent_thread()) {
+    return;
+  }

(Also by curiosity, add_thread has an assert on the Threads_lock but not
thread_exiting?)

Thanks,
Jc


On Tue, Oct 16, 2018 at 9:52 AM <dean.long at oracle.com> wrote:

> https://bugs.openjdk.java.net/browse/JDK-8021335
> http://cr.openjdk.java.net/~dlong/8021335/webrev.3/
>
> This change attempts to fix an old and intermittent problem with
> ThreadMXBean thread counts.
> Changes have 3 main parts:
> 1. Make sure hidden threads don't affect counts (even when exiting)
> 2. Fix race reading counts using atomic counters
> 3. Remove some workarounds in test (because they hide bugs)
>
> dl
>


-- 

Thanks,
Jc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20181016/6c9b6622/attachment.html>


More information about the serviceability-dev mailing list