Skip to content

Commit

Permalink
8308429: jvmti/StopThread/stopthrd007 failed with "NoClassDefFoundErr…
Browse files Browse the repository at this point in the history
…or: Could not initialize class jdk.internal.misc.VirtualThreads"

Reviewed-by: dholmes, sspitsyn
  • Loading branch information
lmesnik committed Oct 3, 2023
1 parent c47a0ce commit 0e501f6
Showing 1 changed file with 8 additions and 1 deletion.
@@ -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.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -28,6 +28,8 @@
import nsk.share.*;
import nsk.share.jvmti.*;

import java.util.concurrent.locks.LockSupport;

public class stopthrd007 extends DebugeeClass {

// run test from command line
Expand Down Expand Up @@ -66,6 +68,11 @@ public int runIt(String argv[], PrintStream out) {
log = new Log(out, argHandler);
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");

startingBarrier = new Wicket(3);
Expand Down

1 comment on commit 0e501f6

@openjdk-notifier
Copy link

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.