On Thu, 18 Jul 2024 18:50:48 GMT, Chris Plummer <[email protected]> wrote:
> The test is failing with an ObjectCollectedException. The test hits a
> SUSPEND_ALL breakpoint. It then uses JDI to allocate an Object on the
> debuggee side:
>
> testedObject = testedClass.newInstance(thread, ctor, params, 0);
>
> Since we are under a SUSPEND_ALL, the object is not initially at risk of
> getting GC'd. However, the test then calls invokeMethod() in a loop:
>
> if (method.isStatic()) {
> voidValue = (VoidValue) testedClass.invokeMethod(thread,
> method, params, 0);
> } else {
> voidValue = (VoidValue) testedObject.invokeMethod(thread,
> method, params, 0);
> }
>
> On the first iteration of the loop, invokeMethod() will do a resumeAll() so
> it can execute the method on the specified thread. During this time a GC can
> happen, and that GC is likely to collect the object that testedObject is
> mirroring since it is only weakly kept alive. Then on a subsequent iteration
> of the loop, testedObject.invokeMethod() is called again, but this time you
> get the ObjectCollectedException because the object that testedObject is
> mirroring has been collected. The test needs to add a call to
> testedObject.disableCollection() to prevent it from being collected.
>
> I'm not able to reproduce this failure, but the bug is pretty clear. Testing
> is in progress. I'll run tier1 CI and also tier2 and tier5 test tasks that
> run this test.
This pull request has now been integrated.
Changeset: e7e48a78
Author: Chris Plummer <[email protected]>
URL:
https://git.openjdk.org/jdk/commit/e7e48a780a34007994f830869fdb74ba1cb5b3fe
Stats: 5 lines in 1 file changed: 5 ins; 0 del; 0 mod
8248609: [Graal]
vmTestbase/nsk/jdi/VoidValue/toString/tostring001/TestDescription.java failed
with Unexpected com.sun.jdi.ObjectCollectedException
Reviewed-by: amenkov, lmesnik
-------------
PR: https://git.openjdk.org/jdk/pull/20242