From e7e48a780a34007994f830869fdb74ba1cb5b3fe Mon Sep 17 00:00:00 2001 From: Chris Plummer Date: Fri, 19 Jul 2024 21:53:04 +0000 Subject: [PATCH] 8248609: [Graal] vmTestbase/nsk/jdi/VoidValue/toString/tostring001/TestDescription.java failed with Unexpected com.sun.jdi.ObjectCollectedException Reviewed-by: amenkov, lmesnik --- .../vmTestbase/nsk/jdi/VoidValue/toString/tostring001.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/toString/tostring001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/toString/tostring001.java index f1d1baf06be..b2cdb6acef4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/toString/tostring001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/toString/tostring001.java @@ -140,6 +140,10 @@ public class tostring001 { try { testedObject = testedClass.newInstance(thread, ctor, params, 0); + // Disable collection on testedObject. invokeMethod() will essentially do a + // vm.resume(), which gives GC a chance to run, which might result in this + // object being collected. + testedObject.disableCollection(); } catch (Exception e) { throw new Failure("unexpected " + e + " when invoking debuggee's constructor"); } @@ -178,6 +182,7 @@ public class tostring001 { } display("Checking of debuggee's void value methods completed!"); + testedObject.enableCollection(); debuggee.resume(); }