Skip to content
Permalink
Browse files
8270961: [TESTBUG] Move GotWrongOOMEException into vm.share.gc package
Reviewed-by: kbarrett, tschatzl
  • Loading branch information
lmesnik committed Jul 22, 2021
1 parent 3cadc36 commit 258f188bff07b6c873128a181746afcf8053d936
Showing 3 changed files with 11 additions and 14 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,13 +24,13 @@

import java.net.MalformedURLException;

import vm.share.gc.HeapOOMEException;
import vm.share.gc.TriggerUnloadingByFillingMetaspace;
import vm.share.gc.TriggerUnloadingHelper;
import vm.share.gc.TriggerUnloadingWithWhiteBox;

import metaspace.stressHierarchy.common.classloader.tree.Node;
import metaspace.stressHierarchy.common.classloader.tree.Tree;
import metaspace.stressHierarchy.common.exceptions.GotWrongOOMEException;
import metaspace.stressHierarchy.common.exceptions.TimeIsOverException;
import metaspace.stressHierarchy.common.generateHierarchy.GenerateHierarchyHelper;
import metaspace.stressHierarchy.common.generateHierarchy.GenerateHierarchyHelper.Type;
@@ -109,8 +109,8 @@ public void run() {

System.out.println("Whole test took " + ((System.currentTimeMillis() - startTimeStamp)/1000/60.0) +" min");
log.info("Test PASSED");
} catch (GotWrongOOMEException e) {
log.info("GotWrongOOMEExc: " + e.getMessage());
} catch (HeapOOMEException e) {
log.info("HeapOOMEException: " + e.getMessage());
log.info("Got wrong type of OOME. We are passing test as it breaks test logic. We have dedicated test configurations" +
" for each OOME type provoking class unloading, that's why we are not missing test coverage here.");
} catch (OutOfMemoryError e) {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -20,18 +20,16 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package metaspace.stressHierarchy.common.exceptions;
package vm.share.gc;

/**
* Usually this means that we got OOME:heap while trying to gain OOME:metaspace.
* We pass test in this case as this breaks test logic. We have dedicated test configurations
* for OOME:heap provoking class unloading, that why we are not missing test coverage here.
* This class is used to distinguish between OOME in metaspace and OOME in heap when triggering class unloading.
*/
public class GotWrongOOMEException extends RuntimeException {
public class HeapOOMEException extends RuntimeException {

private static final long serialVersionUID = 1L;

public GotWrongOOMEException(String string) {
public HeapOOMEException(String string) {
super(string);
}

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,6 @@
package vm.share.gc;

import nsk.share.test.ExecutionController;
import metaspace.stressHierarchy.common.exceptions.GotWrongOOMEException;
import nsk.share.gc.gp.classload.GeneratedClassProducer;

public class TriggerUnloadingByFillingMetaspace implements
@@ -50,7 +49,7 @@ public void triggerUnloading(ExecutionController stresser) {
generatedClassProducer.get().create(-100500); //argument is not used.
} catch (Throwable oome) {
if (!isInMetaspace(oome)) {
throw new GotWrongOOMEException("Got OOME in heap while triggering OOME in metaspace. Test result can't be valid.");
throw new HeapOOMEException("Got OOME in heap while triggering OOME in metaspace. Test result can't be valid.");
}
gotOOME = true;
}

1 comment on commit 258f188

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 258f188 Jul 22, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.