diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt
index 084136444b3..a9014d2c266 100644
--- a/test/hotspot/jtreg/ProblemList.txt
+++ b/test/hotspot/jtreg/ProblemList.txt
@@ -214,11 +214,4 @@ vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_b/TestDescription.java
vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn001/forceEarlyReturn001.java 7199837 generic-all
-vmTestbase/metaspace/stressHierarchy/stressHierarchy007/TestDescription.java 8208697 generic-all
-vmTestbase/metaspace/stressHierarchy/stressHierarchy008/TestDescription.java 8208697 generic-all
-vmTestbase/metaspace/stressHierarchy/stressHierarchy009/TestDescription.java 8208697 generic-all
-vmTestbase/metaspace/stressHierarchy/stressHierarchy010/TestDescription.java 8208697 generic-all
-vmTestbase/metaspace/stressHierarchy/stressHierarchy011/TestDescription.java 8208697 generic-all
-vmTestbase/metaspace/stressHierarchy/stressHierarchy012/TestDescription.java 8208697 generic-all
-
#############################################################################
diff --git a/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/PerformChecksHelper.java b/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/PerformChecksHelper.java
index 28b4ef29407..183bd467bfa 100644
--- a/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/PerformChecksHelper.java
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/PerformChecksHelper.java
@@ -137,10 +137,10 @@ public class PerformChecksHelper {
}
}
} catch (OutOfMemoryError e) {
- if (e.getMessage().trim().toLowerCase().contains("metadata")) {
- System.out.println("Got OOME in metaspace in PerformChecksHelper.callMethods(Class clazz). " +
- "This happened because reflection generates a too many accessors. " +
- "There is nothing we can do with it, so we are just suppressing.");
+ if (e.getMessage().trim().toLowerCase().contains("metaspace")) {
+ // avoid string concatenation, which may create more classes.
+ System.out.println("Got OOME in metaspace in PerformChecksHelper.callMethods(Class clazz). ");
+ System.out.println("This is possible with -triggerUnloadingByFillingMetaspace");
} else {
throw e;
}
diff --git a/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/StressHierarchyBaseClass.java b/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/StressHierarchyBaseClass.java
index 58df81321e9..3ce0a825285 100644
--- a/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/StressHierarchyBaseClass.java
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/StressHierarchyBaseClass.java
@@ -39,15 +39,13 @@ import metaspace.stressHierarchy.common.generateHierarchy.TreeDescriptor;
import nsk.share.test.ExecutionController;
import nsk.share.test.Stresser;
import nsk.share.test.TestBase;
-import nsk.share.test.timeoutwatchdog.TimeoutHandler;
-import nsk.share.test.timeoutwatchdog.TimeoutWatchdog;
/**
* Superclass for StressHierarchy* tests. It provides util methods to create and load
* classes hierarchy and perform checks.
*/
-abstract public class StressHierarchyBaseClass extends TestBase implements TimeoutHandler {
+abstract public class StressHierarchyBaseClass extends TestBase {
protected static String[] args;
@@ -101,7 +99,6 @@ abstract public class StressHierarchyBaseClass extends TestBase implements Timeo
long startTimeStamp = System.currentTimeMillis();
ExecutionController stresser = new Stresser(args);
stresser.start(1);
- TimeoutWatchdog.watch(stresser, this);
TreeDescriptor treeDescriptor = GenerateHierarchyHelper.generateHierarchy(treeDepth, minLevelSize, maxLevelSize, hierarchyType);
Tree tree = buildTree(treeDescriptor);
System.out.println("Generating took " + ((System.currentTimeMillis() - startTimeStamp)/1000) +" sec");
@@ -128,12 +125,6 @@ abstract public class StressHierarchyBaseClass extends TestBase implements Timeo
}
}
- @Override
- public void handleTimeout() {
- System.out.println("Shutting down vm because of time expired.");
- System.exit(95);
- }
-
abstract protected void runTestLogic(Tree tree, ExecutionController stresser) throws Throwable;
private Tree buildTree(TreeDescriptor treeDescriptor) throws MalformedURLException,
diff --git a/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/stressHierarchy012/TestDescription.java b/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/stressHierarchy012/TestDescription.java
index 17e243db99f..be963af932f 100644
--- a/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/stressHierarchy012/TestDescription.java
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/stressHierarchy012/TestDescription.java
@@ -37,7 +37,7 @@
* @comment generate and compile metaspace.stressHierarchy.common.HumongousClass
* @run driver metaspace.stressHierarchy.common.GenClassesBuilder
* @run main/othervm
- * -XX:MaxMetaspaceSize=450m
+ * -XX:MaxMetaspaceSize=250m
* -Xss10m
* -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/classload/GeneratingClassLoader.java b/test/hotspot/jtreg/vmTestbase/nsk/share/classload/GeneratingClassLoader.java
index 37215400e97..c508f0fc57a 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/classload/GeneratingClassLoader.java
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/classload/GeneratingClassLoader.java
@@ -119,8 +119,6 @@ public class GeneratingClassLoader extends ClassLoader {
return bytecode;
} catch (UnsupportedEncodingException e) {
throw new TestBug(e);
- } catch (IOException e) {
- throw new TestBug(e);
}
}
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/test/timeoutwatchdog/TimeoutHandler.java b/test/hotspot/jtreg/vmTestbase/nsk/share/test/timeoutwatchdog/TimeoutHandler.java
deleted file mode 100644
index e487d621126..00000000000
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/test/timeoutwatchdog/TimeoutHandler.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2013, 2018, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package nsk.share.test.timeoutwatchdog;
-
-/**
- * TimeoutHandler - interface to define reaction on timeout.
- * @see TimeoutWatchdoc
- */
-public interface TimeoutHandler {
-
- /**
- * Invoked when watchdog detects timeout. Subclasses must implement this method to define how timeout should be handled.
- */
- void handleTimeout();
-
-}
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/test/timeoutwatchdog/TimeoutWatchdog.java b/test/hotspot/jtreg/vmTestbase/nsk/share/test/timeoutwatchdog/TimeoutWatchdog.java
deleted file mode 100644
index d5f112b33aa..00000000000
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/test/timeoutwatchdog/TimeoutWatchdog.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2013, 2018, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package nsk.share.test.timeoutwatchdog;
-
-import nsk.share.test.ExecutionController;
-
-/**
- * This class watches for ExecutionControler and notifies TimeoutHander in case of timeout.
- */
-public class TimeoutWatchdog implements Runnable {
-
- private ExecutionController executionController;
-
- private TimeoutHandler handler;
-
- private static long CHECK_PERIOD = 1000; // In milliseconds
-
- private TimeoutWatchdog(ExecutionController executionController, TimeoutHandler handler) {
- this.executionController = executionController;
- this.handler = handler;
- }
-
- /**
- * Start watching for timeout.
- * This method runs a new daemon thread that checks periodically if the observable test is still running.
- * If timeout is detected handler.handleTimeout() will be called. If the test finishes normally the daemon
- * thread will silently die.
- * @param executionController - executionController used to monitor time left
- * @param handler - handler on which handleTimeout() will be called
- */
- public static void watch(ExecutionController executionController, TimeoutHandler handler) {
- Thread thread = new Thread(new TimeoutWatchdog(executionController, handler));
- thread.setName("TimeoutWatchdog_thread");
- thread.setDaemon(true);
- thread.start();
- }
-
- @Override
- public void run() {
- try {
- while (true) {
- Thread.sleep(CHECK_PERIOD);
- if (!executionController.continueExecution()) {
- System.out.println("Time expired. TimeoutWatchdog is calling TimeoutHandler.handleTimeout.");
- handler.handleTimeout();
- }
- }
- } catch (InterruptedException e) {
- throw new RuntimeException("Somebody dared to interrupt TimeoutWatchdog thread.");
- }
- }
-
-}
diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingByFillingHeap.java b/test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingByFillingHeap.java
deleted file mode 100644
index 3b4481e4fe7..00000000000
--- a/test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingByFillingHeap.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2013, 2018, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package vm.share.gc;
-
-import java.lang.management.ManagementFactory;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
-import nsk.share.TestFailure;
-import nsk.share.test.ExecutionController;
-
-public class TriggerUnloadingByFillingHeap implements TriggerUnloadingHelper {
-
- public void triggerUnloading(ExecutionController stresser) {
- List jvmArgs = ManagementFactory.getRuntimeMXBean().getInputArguments();
- if (jvmArgs.contains("-XX:+ExplicitGCInvokesConcurrent")) {
- throw new TestFailure("Test bug! Found -XX:+ExplicitGCInvokesConcurrent in jvm args. TriggerUnloadingByFillingHeap.triggerUnloading will not work!.");
- }
-
- System.out.println("collections invoked: " + provokeGC(stresser));
- System.out.println("collections invoked: " + provokeGC(stresser));
- System.out.println("collections invoked: " + provokeGC(stresser));
- }
-
- private static long getGCCounter() {
- return ManagementFactory.getGarbageCollectorMXBeans().get(1).getCollectionCount();
- }
-
- private static Random random = new Random();
-
- public static byte[] garbage; //make it reference public to avoid compiler optimizations
-
- private static long provokeGC(ExecutionController stresser) {
- long initCounter = getGCCounter();
- ArrayList list = new ArrayList();
- while (getGCCounter() == initCounter && stresser.continueExecution()) {
- list.add(new byte[1024]);
-
- garbage = new byte[1024];
- if (random.nextInt(10) % 10 < 3 && !list.isEmpty()) {
- list.remove(0);
- }
- System.gc();
- }
- return getGCCounter() - initCounter;
- }
-
-}
diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingByFillingMetaspace.java b/test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingByFillingMetaspace.java
index 13f6dfed07e..1f79b095fdc 100644
--- a/test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingByFillingMetaspace.java
+++ b/test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingByFillingMetaspace.java
@@ -22,76 +22,38 @@
*/
package vm.share.gc;
-import java.util.ArrayList;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
+import nsk.share.test.ExecutionController;
import metaspace.stressHierarchy.common.exceptions.GotWrongOOMEException;
import nsk.share.gc.gp.classload.GeneratedClassProducer;
-import nsk.share.test.ExecutionController;
public class TriggerUnloadingByFillingMetaspace implements
TriggerUnloadingHelper {
- private static final int NUMBER_OF_THREADS = 30;
+ private volatile boolean gotOOME = false;
+ private ExecutionController stresser;
+ private final ThreadLocal generatedClassProducer =
+ new ThreadLocal() {
+ @Override
+ protected GeneratedClassProducer initialValue() {
+ return new GeneratedClassProducer("metaspace.stressHierarchy.common.HumongousClass");
+ }
+ };
- private static class FillMetaspace {
- private volatile boolean gotOOME = false;
- private ExecutionController stresser;
- private final ThreadLocal generatedClassProducer =
- new ThreadLocal() {
- @Override
- protected GeneratedClassProducer initialValue() {
- return new GeneratedClassProducer("metaspace.stressHierarchy.common.HumongousClass");
- }
- };
-
- public FillMetaspace(ExecutionController stresser) { this.stresser = stresser; }
-
- private class FillMetaspaceTask implements Callable