Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8277092: TestMetaspaceAllocationMT2.java#ndebug-default fails with "R…
…untimeException: Committed seems high: NNNN expected at most MMMM"

Reviewed-by: coleenp
  • Loading branch information
tstuefe committed Nov 19, 2021
1 parent e47cc81 commit a3406a1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
@@ -1,9 +1,7 @@

import sun.hotspot.WhiteBox;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

public class MetaspaceTestContext {

Expand Down Expand Up @@ -140,6 +138,9 @@ public void checkStatistics() {
long usageMeasured = usedWords();
long committedMeasured = committedWords();

System.out.println("context used words " + usageMeasured + ", committed words " + committedMeasured
+ ".");

if (usageMeasured > committedMeasured) {
throw new RuntimeException("Weirdness.");
}
Expand Down
Expand Up @@ -83,6 +83,19 @@ public void runTest() throws Exception {
// Stop all threads.
stopAllThreads();

// At this point a large number of Arenas will have died (see above), but we probably still have
// some live arenas left. The chunk freelist will be full of free chunks. Maybe a bit fragmented,
// with a healthy mixture of larger and smaller chunks, since we still have live arenas.
// These chunks are all committed still, since we did nothing to reclaim the storage. We now purge
// the context manually to uncommit those chunks, in order to get a realistic number for
// committed words (see checkStatistics()).
// Note: In real metaspace, this happens as part of the same GC which removes class loaders and
// frees their metaspace arenas. All within CLDG::purge(). But since this test isolates the metaspace
// context and does test it separately, GC and CLDG are not involved here. We need to purge manually.
//
// Purging uncommits all free chunks >= 64K/16K (MetaspaceReclaimPolicy=standard/aggressive).
context.purge();

context.updateTotals();
System.out.println(" ## Finished: " + context);

Expand Down

3 comments on commit a3406a1

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on a3406a1 Sep 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on a3406a1 Sep 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin the backport was successfully created on the branch GoeLin-backport-a3406a1d in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit a3406a1d from the openjdk/jdk repository.

The commit being backported was authored by Thomas Stuefe on 19 Nov 2021 and was reviewed by Coleen Phillimore.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev GoeLin-backport-a3406a1d:GoeLin-backport-a3406a1d
$ git checkout GoeLin-backport-a3406a1d
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev GoeLin-backport-a3406a1d

Please sign in to comment.