8308429: jvmti/StopThread/stopthrd007 failed with "NoClassDefFoundError: Could not initialize class jdk.internal.misc.VirtualThreads"

Reviewed-by: dholmes, sspitsyn
This commit is contained in:
Leonid Mesnik 2023-10-03 15:03:21 +00:00
parent c47a0ce3f0
commit 0e501f66df

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,8 @@ import java.io.PrintStream;
import nsk.share.*; import nsk.share.*;
import nsk.share.jvmti.*; import nsk.share.jvmti.*;
import java.util.concurrent.locks.LockSupport;
public class stopthrd007 extends DebugeeClass { public class stopthrd007 extends DebugeeClass {
// run test from command line // run test from command line
@ -66,6 +68,11 @@ public class stopthrd007 extends DebugeeClass {
log = new Log(out, argHandler); log = new Log(out, argHandler);
timeout = argHandler.getWaitTime() * 60 * 1000; timeout = argHandler.getWaitTime() * 60 * 1000;
// Unpark virtual threads to load jdk.internal.misc.VirtualThreads
// and avoid NoClassDefFoundError if ThreadDeath is happen during unlock.
Thread vt = Thread.startVirtualThread(LockSupport::park);
LockSupport.unpark(vt);
log.display("Debugee started"); log.display("Debugee started");
startingBarrier = new Wicket(3); startingBarrier = new Wicket(3);