Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8270961: [TESTBUG] Move GotWrongOOMEException into vm.share.gc package #4844

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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,13 @@ 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) {
/**
* 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.
*/

Choose a reason for hiding this comment

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

This comment is unnecessary, as it adds nothing over the log message that follows.

Copy link
Member Author

@lmesnik lmesnik Jul 22, 2021

Choose a reason for hiding this comment

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

Thanks! I just moved it and missed that is the same as the log message.

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 differ OOME in metaspace and heap when trigger class unloading.

Choose a reason for hiding this comment

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

That doesn't scan so well. Perhaps something like
"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;
}