On Thu, 11 Aug 2022 18:27:12 GMT, Kevin Walls <kev...@openjdk.org> wrote:
> This is test unstable when monitoring CodeHeap pools as they can change > outside the test's control. > Attempting more heuristics to sense these unrelated changes just means we > skip more pools. > > The test design, making a Java allocation to affect a memory pool, shows it > was intended for Java heap pools, so the test should focus on them. If we > make a larger allocation during the test we actually can observe a change in > size in the old gen pools it monitors (new gen pools are not expected to have > thresholds, so they are skipped). > > There exist specific tests in test/hotspot/jtreg/compiler/codecache/jmx which > are intended for non-heap pools, so we should skip them intentionally here in > isUsageThresholdExceeded. > > Other edits in the test to fix that the peak usage reported by the test was > simply usage, not peak. Fetch the usage and peak usage as near together as > possible in the test. At line 110 in the test, remove an attempt to skip > pools we can't monitor (which was working, but does not cover all cases). > > > Example test log, showing allocation that hits the old gen and triggers the > threshold set by the test: > > ----------System.out:(15/796)---------- > ... > 5 pool G1 Old Gen of type: Heap memory > used value is 1024000 max is 1038090240 isExceeded = false > peak used value is 1024000 > threshold set to 1024001 > threshold count 0 > reset peak usage. peak usage = 1024000 isExceeded = false > Allocated heap. isExceeded = true > used value is 106930176 max is 1038090240 isExceeded = true > peak used value is 106930176 peak max is 1038090240 > threshold count 1 This pull request has now been integrated. Changeset: 3601e30d Author: Kevin Walls <kev...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/3601e30df794db122d8d04fb3c04868ccbaa0baf Stats: 19 lines in 1 file changed: 4 ins; 8 del; 7 mod 8290909: MemoryPoolMBean/isUsageThresholdExceeded tests failed with "isUsageThresholdExceeded() returned false, and is still false, while threshold = MMMMMMM and used peak = NNNNNNN" Reviewed-by: cjplummer, amenkov ------------- PR: https://git.openjdk.org/jdk/pull/9842