From 2fa9eb67648c62c97b7f0368f474d7e56766038e Mon Sep 17 00:00:00 2001 From: Chris Plummer Date: Fri, 29 May 2026 17:05:56 +0000 Subject: [PATCH] 8375076: Two JDI scenario tests are failing with out of wait time after completing successfully Reviewed-by: sspitsyn, dholmes --- .../nsk/jdi/BScenarios/multithrd/tc02x004.java | 7 ++++++- .../nsk/jdi/BScenarios/multithrd/tc04x001.java | 10 +++++++++- .../nsk/jdi/BScenarios/multithrd/tc04x001a.java | 11 ++++++++--- .../nsk/jdi/Scenarios/invokeMethod/popframes001.java | 5 +---- .../nsk/jdi/Scenarios/invokeMethod/popframes001a.java | 9 +++++++-- .../jdi/ThreadReference/popFrames/popframes003.java | 3 ++- 6 files changed, 33 insertions(+), 12 deletions(-) diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004.java index 771313f4c1a..d23744e5d26 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2026, 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 @@ -227,5 +227,10 @@ public class tc02x004 { display(""); brkpEventCount++; + if (brkpEventCount == tc02x004a.threadCount) { + // When done we disable the MethodEntryRequest because we don't + // want it enabled while the debuggee exits. See JDK-8375076 and JDK-8384569. + event.request().disable(); + } } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001.java index 612acbcc55a..6900653e9fb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2026, 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,14 @@ public class tc04x001 { display("\tmethod\t- " + event.location().method().name()); display("\tline\t- " + event.location().lineNumber()); + // When done() is called we disable the MethodEntryRequest because we don't + // want it enabled while the debuggee exits. See JDK-8375076 and JDK-8384569. + if (event.method().name().equals("done")) { + display("done() called - disabling MethodEntryRequest\n"); + event.request().disable(); + return; + } + if (!event.method().name().equals(methodName)) { display("the event skipped, method - " + event.method().name() + "\n"); return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001a.java index a343c6c5116..1a380132b2f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2026, 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 @@ -29,14 +29,14 @@ import nsk.share.jdi.*; // THIS TEST IS LINE NUMBER SENSITIVE /** - * tc04x001a is deugee's part of the tc04x001. + * tc04x001a is debugee's part of the tc04x001. */ public class tc04x001a { public final static int threadCount = 3; static Log log; - public final static int checkMethodBrkpLine = 73; + public final static int checkMethodBrkpLine = 74; Thread[] thrds = new Thread[threadCount]; public static void main (String argv[]) { @@ -58,6 +58,7 @@ public class tc04x001a { System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); } } + done(); // Signal the disabling of MethodEntryRequest log.display("completed succesfully."); System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); } @@ -77,6 +78,10 @@ public class tc04x001a { log.display(caller + "::bar is called"); } + public static void done() { + log.display("done is called"); + } + static class Thready extends NamedTask { Thready(String name) { super(name); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001.java index 022f8ceff9b..eaad7f4ffce 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001.java @@ -160,10 +160,9 @@ public class popframes001 { if (eventIterator != null) { while (eventIterator.hasNext()) { event = eventIterator.nextEvent(); -// display("\nevent ===>>> " + event); + display("\nevent ===>>> " + event); if (event instanceof ClassPrepareEvent) { - display("\nevent ===>>> " + event); testedClass = (ClassType )debugee.classByName(testedClassName); debugeeClass = (ClassType )debugee.classByName(debugeeName); @@ -179,11 +178,9 @@ public class popframes001 { debugee.resume(); } else if (event instanceof MethodExitEvent) { - display("\nevent ===>>> " + event); hitMethodExitEvent((MethodExitEvent )event); } else if (event instanceof MethodEntryEvent) { - display("\nevent ===>>> " + event); hitMethodEntryEvent((MethodEntryEvent )event); display("\nresuming..."); debugee.resume(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001a.java index 42d8f5446c6..a6cd451333a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2026, 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 @@ -30,7 +30,7 @@ import nsk.share.jdi.*; import java.io.*; /** - * popframes001a is deugee's part of the popframes001. + * popframes001a is debugee's part of the popframes001. */ public class popframes001a { @@ -38,6 +38,11 @@ public class popframes001a { volatile public static boolean finishIt = false; public static void main(String argv[]) { + // The following will cause intialization of a bunch of classes before we + // enable MethodEntry/Exit events, which would otherwise result in long test runs. + // See JDK-8375076 and JDK-8384569. + System.getLogger("java.lang.Runtime"); + ArgumentHandler argHandler = new ArgumentHandler(argv); Log log = new Log(System.out, argHandler); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003.java index 117a626752c..fb6ce0be740 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, 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 @@ -408,6 +408,7 @@ public class popframes003 extends JDIBase { } log2("......disabling requests and resuming vm"); + meRequest.disable(); meRequest3.disable(); vm.resume();