RFR: 8264632: compiler/codecache/jmx/PoolsIndependenceTest.java fails to Notification not being received

Evgeny Nikitin enikitin at openjdk.java.net
Tue Apr 20 18:11:35 UTC 2021

Hi all,

May I ask for reviews for this change? 

**The case**

**The problem**
The test calls for MemoryPoolMXBean.setUsageThreshold() and expects a Notification get fired when the threshold is breached. The Notification is never received.

The failure most probably is caused by the combination of following events:
1. Some threshold has already breached (caused by some other tests); 
2. In this case MemoryPoolMXBean never fires subsequent Notifications until the usage is less than a set threshold;
3. The usage manages to grow up between these two lines[1]:

final long usageThresholdLimit = bean.getUsage().getUsed() + 1;

4. The usage has never fallen below any set threshold and therefore Notification is never sent. Setting usageThresholdLimit to 0 doesn't clear up the situation "Notification has already been sent" either.

[1] Very common, happens almost every time during my testing - the code cache usage grows up quickly at VM start.

**Proposed solution:**
1. Before the actual test, I set the usageThresholdLimit to max. possible value;
2. This causes the current usage to appear below the threshold and therefore the "Notification has already been sent" state is cleared;
3. The monitoring is then switched off (by setting usageThresholdLimit to 0), as at the VM start.

1. Preemptive breaching of some threshold causes the problem for non-modified test.
2. The modified test has been tested with debug versions of macosx, windows, linux x64 builds and a linux-aarch64-debug build.



Commit messages:
 - 8264632: compiler/codecache/jmx/PoolsIndependenceTest.java fails to Notification not being received

Changes: https://git.openjdk.java.net/jdk/pull/3592/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3592&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8264632
  Stats: 13 lines in 2 files changed: 12 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3592.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3592/head:pull/3592

PR: https://git.openjdk.java.net/jdk/pull/3592

More information about the hotspot-compiler-dev mailing list