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

2018-10-24 Thread dean . long
On 10/23/18 11:04 PM, Mandy Chung wrote: On 10/23/18 10:34 PM, David Holmes wrote: On 24/10/2018 8:30 AM, dean.l...@oracle.com wrote: On 10/23/18 2:51 PM, David Holmes wrote: Hi Dean, On 24/10/2018 4:05 AM, dean.l...@oracle.com wrote: On 10/23/18 9:46 AM, dean.l...@oracle.com wrote: On

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

2018-10-24 Thread Mandy Chung
On 10/23/18 10:34 PM, David Holmes wrote: On 24/10/2018 8:30 AM, dean.l...@oracle.com wrote: On 10/23/18 2:51 PM, David Holmes wrote: Hi Dean, On 24/10/2018 4:05 AM, dean.l...@oracle.com wrote: On 10/23/18 9:46 AM, dean.l...@oracle.com wrote: On 10/22/18 3:31 PM, David Holmes wrote: Sorry

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

2018-10-23 Thread David Holmes
On 24/10/2018 8:30 AM, dean.l...@oracle.com wrote: On 10/23/18 2:51 PM, David Holmes wrote: Hi Dean, On 24/10/2018 4:05 AM, dean.l...@oracle.com wrote: On 10/23/18 9:46 AM, dean.l...@oracle.com wrote: On 10/22/18 3:31 PM, David Holmes wrote: Sorry Dean I'm concerned about a thread

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

2018-10-23 Thread Mandy Chung
On 10/23/18 3:30 PM, dean.l...@oracle.com wrote: On 10/23/18 2:51 PM, David Holmes wrote: OK, but even if the regular benchmarks don't show a difference, I'd feel better if microbenchmarks were not affected.  What if I go back to the original approach and add locking:    static jlong

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

2018-10-23 Thread dean . long
On 10/23/18 2:51 PM, David Holmes wrote: Hi Dean, On 24/10/2018 4:05 AM, dean.l...@oracle.com wrote: On 10/23/18 9:46 AM, dean.l...@oracle.com wrote: On 10/22/18 3:31 PM, David Holmes wrote: Sorry Dean I'm concerned about a thread termination bottleneck with this. A simple microbenchmark

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

2018-10-23 Thread David Holmes
Hi Dean, On 24/10/2018 4:05 AM, dean.l...@oracle.com wrote: On 10/23/18 9:46 AM, dean.l...@oracle.com wrote: On 10/22/18 3:31 PM, David Holmes wrote: Sorry Dean I'm concerned about a thread termination bottleneck with this. A simple microbenchmark that creates 500,000 threads that have to

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

2018-10-23 Thread dean . long
On 10/23/18 9:46 AM, dean.l...@oracle.com wrote: On 10/22/18 3:31 PM, David Holmes wrote: Sorry Dean I'm concerned about a thread termination bottleneck with this. A simple microbenchmark that creates 500,000 threads that have to run and terminate, shows a 15+% slowdown on my Linux box. I

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

2018-10-23 Thread dean . long
On 10/22/18 3:31 PM, David Holmes wrote: Sorry Dean I'm concerned about a thread termination bottleneck with this. A simple microbenchmark that creates 500,000 threads that have to run and terminate, shows a 15+% slowdown on my Linux box. I tried to find some kind of real benchmarks that

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

2018-10-22 Thread David Holmes
Sorry Dean I'm concerned about a thread termination bottleneck with this. A simple microbenchmark that creates 500,000 threads that have to run and terminate, shows a 15+% slowdown on my Linux box. I tried to find some kind of real benchmarks that covers thread termination but couldn't see

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

2018-10-19 Thread dean . long
On 10/18/18 6:12 PM, Mandy Chung wrote: On 10/18/18 12:27 AM, David Holmes wrote: Hi Dean, On 18/10/2018 2:06 PM, dean.l...@oracle.com wrote: You're right, I missed that.  I think the right thing to do is call current_thread_exiting while holding the Threads_lock. Then we can get rid of

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

2018-10-18 Thread Mandy Chung
On 10/18/18 12:27 AM, David Holmes wrote: Hi Dean, On 18/10/2018 2:06 PM, dean.l...@oracle.com wrote: You're right, I missed that.  I think the right thing to do is call current_thread_exiting while holding the Threads_lock. Then we can get rid of the parallel atomic counters.  So, here's

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

2018-10-18 Thread David Holmes
Hi Dean, On 18/10/2018 2:06 PM, dean.l...@oracle.com wrote: On 10/17/18 7:07 PM, David Holmes wrote: Hi Dean, This still seems racy to me. We increment all counts under the Threads_lock but we still decrement without the Threads_lock. So we can lose updates to the perfCounters.  117  

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

2018-10-17 Thread dean . long
On 10/17/18 7:07 PM, David Holmes wrote: Hi Dean, This still seems racy to me. We increment all counts under the Threads_lock but we still decrement without the Threads_lock. So we can lose updates to the perfCounters.  117   _total_threads_count->inc();  118  

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

2018-10-17 Thread dean . long
Thanks, Mandy! dl On 10/17/18 6:35 PM, Mandy Chung wrote: On 10/17/18 3:18 PM, dean.l...@oracle.com wrote: New webrevs, full and incremental: http://cr.openjdk.java.net/~dlong/8021335/webrev.6/ http://cr.openjdk.java.net/~dlong/8021335/webrev.6.diff/ I like it better without all the

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

2018-10-17 Thread David Holmes
Hi Dean, This still seems racy to me. We increment all counts under the Threads_lock but we still decrement without the Threads_lock. So we can lose updates to the perfCounters. 117 _total_threads_count->inc(); 118 Atomic::inc(&_atomic_threads_count); 119 int count =

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

2018-10-17 Thread Mandy Chung
On 10/17/18 3:18 PM, dean.l...@oracle.com wrote: New webrevs, full and incremental: http://cr.openjdk.java.net/~dlong/8021335/webrev.6/ http://cr.openjdk.java.net/~dlong/8021335/webrev.6.diff/ I like it better without all the asserts too. Looks good to me. Mandy

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

2018-10-17 Thread dean . long
Thanks JC! dl On 10/17/18 5:06 PM, JC Beyler wrote: Hi Dean, The new webrev looks much better :) LGTM (not a reviewer though :-)). Thanks, Jc On Wed, Oct 17, 2018 at 3:19 PM > wrote: On 10/17/18 2:38 PM, Mandy Chung wrote: On 10/17/18 2:13 PM,

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

2018-10-17 Thread dean . long
On 10/17/18 2:38 PM, Mandy Chung wrote: On 10/17/18 2:13 PM, dean.l...@oracle.com wrote: On 10/17/18 1:41 PM, Mandy Chung wrote: On 10/16/18 7:33 PM, David Holmes wrote: Hi Dean, Thanks for tackling this. I'm still struggling to fully grasp why we need both the PerfCounters and the

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

2018-10-17 Thread Mandy Chung
On 10/17/18 2:13 PM, dean.l...@oracle.com wrote: On 10/17/18 1:41 PM, Mandy Chung wrote: On 10/16/18 7:33 PM, David Holmes wrote: Hi Dean, Thanks for tackling this. I'm still struggling to fully grasp why we need both the PerfCounters and the regular counters. I get that we have to

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

2018-10-17 Thread dean . long
On 10/17/18 1:41 PM, Mandy Chung wrote: On 10/16/18 7:33 PM, David Holmes wrote: Hi Dean, Thanks for tackling this. I'm still struggling to fully grasp why we need both the PerfCounters and the regular counters. I get that we have to decrement the live counts before ensure_join() has

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

2018-10-17 Thread dean . long
On 10/16/18 7:33 PM, David Holmes wrote: Hi Dean, Thanks for tackling this. I'm still struggling to fully grasp why we need both the PerfCounters and the regular counters. I get that we have to decrement the live counts before ensure_join() has allowed Thread.join() to return, to ensure

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

2018-10-17 Thread Mandy Chung
On 10/16/18 7:33 PM, David Holmes wrote: Hi Dean, Thanks for tackling this. I'm still struggling to fully grasp why we need both the PerfCounters and the regular counters. I get that we have to decrement the live counts before ensure_join() has allowed Thread.join() to return, to ensure

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

2018-10-16 Thread David Holmes
Hi Dean, Thanks for tackling this. I'm still struggling to fully grasp why we need both the PerfCounters and the regular counters. I get that we have to decrement the live counts before ensure_join() has allowed Thread.join() to return, to ensure that if we then check the number of threads

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

2018-10-16 Thread dean . long
New webrev: http://cr.openjdk.java.net/~dlong/8021335/webrev.4/ dl On 10/16/18 11:59 AM, dean.l...@oracle.com wrote: On 10/16/18 10:28 AM, JC Beyler wrote: Hi Dean, I noticed a typo here : "are atomically" is in the comment but should no longer be there I believe; the sentence probably

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

2018-10-16 Thread dean . long
On 10/16/18 10:28 AM, JC Beyler wrote: 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 Fixed! Any way we could move this test into a

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

2018-10-16 Thread dean . long
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.