diff --git a/test/hotspot/jtreg/ProblemList-svc-vthread.txt b/test/hotspot/jtreg/ProblemList-svc-vthread.txt index 94a3c28f660..42eaf98afc5 100644 --- a/test/hotspot/jtreg/ProblemList-svc-vthread.txt +++ b/test/hotspot/jtreg/ProblemList-svc-vthread.txt @@ -82,8 +82,6 @@ vmTestbase/nsk/jdb/repeat/repeat001/repeat001.java 8300707 generic-all #### ## NSK JDI tests failing with wrapper -vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011/TestDescription.java 8282379 generic-all - #### ## The test expects an NPE to be uncaught, but nsk.share.MainWrapper ## introduces exception handlers. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011.java index c72e6bd1dfb..7d37b279382 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -209,6 +209,16 @@ public class invokemethod011 { clsType.setValue(fldToExit, vm.mirrorOf(true)); invThr.join(argHandler.getWaitTime()*60000); + if (invThr.isAlive()) { + // The join failed because the invoke never completed. + log.complain("TEST FAILED: invoke never completed"); + tot_res = Consts.TEST_FAILED; + // Do a vm.resume() to see if that helps. + vm.resume(); + invThr.join(); // let test time out if this fails + return quitDebuggee(); + } + log.display("Thread \"" + invThr.getName() + "\" done"); // check threads status after method invocation diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011t.java index 7a22d2c9483..b3937d4b329 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011t.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011t.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -87,11 +87,15 @@ public class invokemethod011t { static volatile boolean isInvoked = false; static long dummyMeth(long l) throws InterruptedException { + /* + * WARNING: Since this method is called using INVOKE_SINGLE_THREADED, we need to + * be careful not to do anything that might block on another thread. That includes + * calling Thread.sleep(), which can be a problem for virtual threads. + */ invokemethod011t.log.display("dummyMeth: going to loop"); isInvoked = true; while(!doExit) { l--; l++; - Thread.currentThread().sleep(400); } invokemethod011t.log.display("dummyMeth: exiting"); isInvoked = false; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod012.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod012.java index c7a02fe1738..4f2159e1c90 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod012.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod012.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -202,6 +202,15 @@ public class invokemethod012 { clsType.setValue(fldToExit, vm.mirrorOf(true)); invThr.join(argHandler.getWaitTime()*60000); + if (invThr.isAlive()) { + // The join failed because the invoke never completed. + log.complain("TEST FAILED: invoke never completed"); + tot_res = Consts.TEST_FAILED; + // Do a vm.resume() to see if that helps. + vm.resume(); + invThr.join(); // let test time out if this fails + return quitDebuggee(); + } log.display("Thread \"" + invThr.getName() + "\" done"); // check threads status after the method invocation diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod012t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod012t.java index 9a93c682f0b..ba32cd25673 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod012t.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod012t.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -89,11 +89,15 @@ public class invokemethod012t { static volatile boolean isInvoked = false; static long dummyMeth(long l) throws InterruptedException { + /* + * WARNING: Since this method is called using INVOKE_SINGLE_THREADED, we need to + * be careful not to do anything that might block on another thread. That includes + * calling Thread.sleep(), which can be a problem for virtual threads. + */ invokemethod012t.log.display("dummyMeth: going to loop"); isInvoked = true; while(!doExit) { l--; l++; - Thread.currentThread().sleep(400); } invokemethod012t.log.display("dummyMeth: exiting"); isInvoked = false; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod013.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod013.java index 68600892b59..a967c2c23ab 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod013.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod013.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -204,6 +204,15 @@ public class invokemethod013 { // finish the invocation clsRef.setValue(fldToExit, vm.mirrorOf(true)); invThr.join(argHandler.getWaitTime()*60000); + if (invThr.isAlive()) { + // The join failed because the invoke never completed. + log.complain("TEST FAILED: invoke never completed"); + tot_res = Consts.TEST_FAILED; + // Do a vm.resume() to see if that helps. + vm.resume(); + invThr.join(); // let test time out if this fails + return quitDebuggee(); + } log.display("Thread \"" + invThr.getName() + "\" done"); // check threads status after the method invocation diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod013t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod013t.java index 792156b9032..94900516f74 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod013t.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod013t.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -88,11 +88,15 @@ public class invokemethod013t { static volatile boolean isInvoked = false; static long dummyMeth(long l) throws InterruptedException { + /* + * WARNING: Since this method is called using INVOKE_SINGLE_THREADED, we need to + * be careful not to do anything that might block on another thread. That includes + * calling Thread.sleep(), which can be a problem for virtual threads. + */ invokemethod013t.log.display("dummyMeth: going to loop"); isInvoked = true; while(!doExit) { l--; l++; - Thread.currentThread().sleep(400); } invokemethod013t.log.display("dummyMeth: exiting"); isInvoked = false; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010.java index 008301025d0..bfa2a50235c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -206,6 +206,16 @@ public class invokemethod010 { objRef.setValue(fldToExit, vm.mirrorOf(true)); invThr.join(argHandler.getWaitTime()*60000); + if (invThr.isAlive()) { + // The join failed because the invoke never completed. + log.complain("TEST FAILED: invoke never completed"); + tot_res = Consts.TEST_FAILED; + // Do a vm.resume() to see if that helps. + vm.resume(); + invThr.join(); // let test time out if this fails + return quitDebuggee(); + } + log.display("Thread \"" + invThr.getName() + "\" done"); // check threads status after method invocation diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010t.java index 2dae569f1fc..d37892a852c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010t.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010t.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -181,11 +181,15 @@ class invokemethod010tDummyClass { volatile boolean isInvoked = false; long longMeth(long l) throws InterruptedException { + /* + * WARNING: Since this method is called using INVOKE_SINGLE_THREADED, we need to + * be careful not to do anything that might block on another thread. That includes + * calling Thread.sleep(), which can be a problem for virtual threads. + */ invokemethod010t.log.display("invokemethod010tDummyClass: longMeth: going to loop"); isInvoked = true; while(!doExit) { l--; l++; - Thread.currentThread().sleep(400); } invokemethod010t.log.display("invokemethod010tDummyClass: longMeth: exiting"); isInvoked = false; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011.java index 090546a2226..1f7c038d397 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -206,6 +206,16 @@ public class invokemethod011 { objRef.setValue(fldToExit, vm.mirrorOf(true)); invThr.join(argHandler.getWaitTime()*60000); + if (invThr.isAlive()) { + // The join failed because the invoke never completed. + log.complain("TEST FAILED: invoke never completed"); + tot_res = Consts.TEST_FAILED; + // Do a vm.resume() to see if that helps. + vm.resume(); + invThr.join(); // let test time out if this fails + return quitDebuggee(); + } + log.display("Thread \"" + invThr.getName() + "\" done"); // check threads status after method invocation diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011t.java index fadc1ab0030..f9733d818e6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011t.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011t.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -181,11 +181,15 @@ class invokemethod011tDummyClass { volatile boolean isInvoked = false; long longMeth(long l) throws InterruptedException { + /* + * WARNING: Since this method is called using INVOKE_SINGLE_THREADED, we need to + * be careful not to do anything that might block on another thread. That includes + * calling Thread.sleep(), which can be a problem for virtual threads. + */ invokemethod011t.log.display("invokemethod011tDummyClass: longMeth: going to loop"); isInvoked = true; while(!doExit) { l--; l++; - Thread.currentThread().sleep(400); } invokemethod011t.log.display("invokemethod011tDummyClass: longMeth: exiting"); isInvoked = false; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012.java index 7e83e5a3fdc..a8de6497684 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -206,6 +206,15 @@ public class invokemethod012 { objRef.setValue(fldToExit, vm.mirrorOf(true)); invThr.join(argHandler.getWaitTime()*60000); + if (invThr.isAlive()) { + // The join failed because the invoke never completed. + log.complain("TEST FAILED: invoke never completed"); + tot_res = Consts.TEST_FAILED; + // Do a vm.resume() to see if that helps. + vm.resume(); + invThr.join(); // let test time out if this fails + return quitDebuggee(); + } log.display("Thread \"" + invThr.getName() + "\" done"); // check threads status after the method invocation diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012t.java index 3f4aab830ae..e2a202014da 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012t.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012t.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -181,11 +181,15 @@ class invokemethod012tDummyClass { volatile boolean isInvoked = false; long longMeth(long l) throws InterruptedException { + /* + * WARNING: Since this method is called using INVOKE_SINGLE_THREADED, we need to + * be careful not to do anything that might block on another thread. That includes + * calling Thread.sleep(), which can be a problem for virtual threads. + */ invokemethod012t.log.display("invokemethod012tDummyClass: longMeth: going to loop"); isInvoked = true; while(!doExit) { l--; l++; - Thread.currentThread().sleep(400); } invokemethod012t.log.display("invokemethod012tDummyClass: longMeth: exiting"); isInvoked = false; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod013.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod013.java index 9685e515eda..ffa71463963 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod013.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod013.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -207,6 +207,15 @@ public class invokemethod013 { objRef.setValue(fldToExit, vm.mirrorOf(true)); invThr.join(argHandler.getWaitTime()*60000); + if (invThr.isAlive()) { + // The join failed because the invoke never completed. + log.complain("TEST FAILED: invoke never completed"); + tot_res = Consts.TEST_FAILED; + // Do a vm.resume() to see if that helps. + vm.resume(); + invThr.join(); // let test time out if this fails + return quitDebuggee(); + } log.display("Thread \"" + invThr.getName() + "\" done"); // check threads status after the method invocation diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod013t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod013t.java index 7b309f07d19..2da848dd3ad 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod013t.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod013t.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -180,11 +180,15 @@ class invokemethod013tDummyClass { volatile boolean isInvoked = false; long longMeth(long l) throws InterruptedException { + /* + * WARNING: Since this method is called using INVOKE_SINGLE_THREADED, we need to + * be careful not to do anything that might block on another thread. That includes + * calling Thread.sleep(), which can be a problem for virtual threads. + */ invokemethod013t.log.display("invokemethod013tDummyClass: longMeth: going to loop"); isInvoked = true; while(!doExit) { l--; l++; - Thread.currentThread().sleep(400); } invokemethod013t.log.display("invokemethod013tDummyClass: longMeth: exiting"); isInvoked = false;