8298596: vmTestbase/nsk/sysdict/vm/stress/chain/chain008/chain008.java fails with "NoClassDefFoundError: Could not initialize class java.util.concurrent.ThreadLocalRandom"

Reviewed-by: ayang, tschatzl
This commit is contained in:
Coleen Phillimore 2023-01-18 15:19:30 +00:00
parent b3684f4bac
commit c3242ee452
2 changed files with 13 additions and 4 deletions
test/hotspot/jtreg
ProblemList-zgc.txt
vmTestbase/nsk/share/gc/gp

@ -43,4 +43,3 @@ vmTestbase/gc/gctests/MemoryEaterMT/MemoryEaterMT.java 8289582 windows-
vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded002/TestDescription.java 8298302 generic-all
vmTestbase/nsk/sysdict/vm/stress/chain/chain007/chain007.java 8298991 linux-x64
vmTestbase/nsk/sysdict/vm/stress/chain/chain008/chain008.java 8298596 linux-x64

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2023, 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
@ -234,11 +234,21 @@ public final class GarbageUtils {
long.class,
OOM_TYPE.class);
private static MethodHandle eat;
static {
try {
eat = MethodHandles.lookup().findStatic(GarbageUtils.class, "eatMemoryImpl", mt);
} catch (Exception nsme) {
// Can't run the test for some unexpected reason
throw new RuntimeException(nsme);
}
}
public static int eatMemory(ExecutionController stresser, GarbageProducer gp, long initialFactor, long minMemoryChunk, long factor, OOM_TYPE type) {
try {
// Using a methodhandle invoke of eatMemoryImpl to prevent inlining of it
MethodHandles.Lookup lookup = MethodHandles.lookup();
MethodHandle eat = lookup.findStatic(GarbageUtils.class, "eatMemoryImpl", mt);
return (int) eat.invoke(stresser, gp, initialFactor, minMemoryChunk, factor, type);
} catch (OutOfMemoryError e) {
return numberOfOOMEs++;