-
Bug
-
Resolution: Fixed
-
P4
-
22
-
b02
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8328102 | 21.0.4-oracle | Mimoun Ghordou | P4 | Resolved | Fixed | b01 |
JDK-8328511 | 21.0.4 | Goetz Lindenmaier | P4 | Resolved | Fixed | b01 |
This test launches a debuggee, which creates 11 instances of its main class, stores them in a static array of the main class, and then the debugger side iterates over all referrers to the main class instaces. Usually this is a pretty quick process and doesn't produce much in the way of output while walking the reference tree of referrers. However, with virtual threads the tree walking and output get unwieldy, and eventually it fails with:
IOException reading output of child java interpreter:Stream closed
java.lang.IllegalThreadStateException
at jdk.jdi/com.sun.tools.jdi.JDWPException.toJDIException(JDWPException.java:76)
at jdk.jdi/com.sun.tools.jdi.ThreadReferenceImpl.name(ThreadReferenceImpl.java:197)
at jdk.jdi/com.sun.tools.jdi.ThreadReferenceImpl.toString(ThreadReferenceImpl.java:637)
at java.base/java.lang.String.valueOf(String.java:4461)
at ReferrersTest.showReferrers(ReferrersTest.java:438)
at ReferrersTest.showReferrers(ReferrersTest.java:466)
And ReferrersTest.showReferrers() has recursed about 200 levels deep. I'm not sure the order of these errors can be relied on. It looks like while walking the referrers tree, the test eventually stumbled upon a thread that had exited (but its Thread object was still alive), and this resulted in the test aborting. If I catch these exceptions, eventually the test times out while still working on referrers.
Judging by some of the output, it appears that introducing the TestScaffold class as a referrer to the main debuggee class is the root cause of all these extra referrers.
The test has a provision to cut off the recursion:
// We have to stop going up a referrer chain in some cases
Type rt = objRef.type();
if (rt instanceof ClassType) {
ClassType ct = (ClassType)rt;
String name = ct.name();
if (name.equals("sun.awt.SoftCache$ValueCell")) {
return;
}
if (name.equals("java.lang.ref.Finalizer")) {
return;
}
if (name.equals("java.lang.ref.SoftReference")) {
return;
}
// oh oh, should really check for a subclass of ClassLoader :-)
if (name.indexOf("ClassLoader") >= 0) {
return;
}
// No doubt there are other reasons to stop ...
}
Adding TestScaffold to the list makes it so the referrer tree walking output is almost identical to what it is when not using virtual threads. Adding java.lang.reflect.Method instead does a slightly better job.
IOException reading output of child java interpreter:Stream closed
java.lang.IllegalThreadStateException
at jdk.jdi/com.sun.tools.jdi.JDWPException.toJDIException(JDWPException.java:76)
at jdk.jdi/com.sun.tools.jdi.ThreadReferenceImpl.name(ThreadReferenceImpl.java:197)
at jdk.jdi/com.sun.tools.jdi.ThreadReferenceImpl.toString(ThreadReferenceImpl.java:637)
at java.base/java.lang.String.valueOf(String.java:4461)
at ReferrersTest.showReferrers(ReferrersTest.java:438)
at ReferrersTest.showReferrers(ReferrersTest.java:466)
And ReferrersTest.showReferrers() has recursed about 200 levels deep. I'm not sure the order of these errors can be relied on. It looks like while walking the referrers tree, the test eventually stumbled upon a thread that had exited (but its Thread object was still alive), and this resulted in the test aborting. If I catch these exceptions, eventually the test times out while still working on referrers.
Judging by some of the output, it appears that introducing the TestScaffold class as a referrer to the main debuggee class is the root cause of all these extra referrers.
The test has a provision to cut off the recursion:
// We have to stop going up a referrer chain in some cases
Type rt = objRef.type();
if (rt instanceof ClassType) {
ClassType ct = (ClassType)rt;
String name = ct.name();
if (name.equals("sun.awt.SoftCache$ValueCell")) {
return;
}
if (name.equals("java.lang.ref.Finalizer")) {
return;
}
if (name.equals("java.lang.ref.SoftReference")) {
return;
}
// oh oh, should really check for a subclass of ClassLoader :-)
if (name.indexOf("ClassLoader") >= 0) {
return;
}
// No doubt there are other reasons to stop ...
}
Adding TestScaffold to the list makes it so the referrer tree walking output is almost identical to what it is when not using virtual threads. Adding java.lang.reflect.Method instead does a slightly better job.
- backported by
-
JDK-8328102 com/sun/jdi/ReferrersTest.java fails with virtual test thread factory
- Resolved
-
JDK-8328511 com/sun/jdi/ReferrersTest.java fails with virtual test thread factory
- Resolved
- relates to
-
JDK-8285422 [LOOM] Some com/sun/jdi test are failing with the vthread wrapper
- Closed
- links to
-
Commit openjdk/jdk21u-dev/b3e81769
-
Commit openjdk/jdk/d7251c17
-
Review openjdk/jdk21u-dev/367
-
Review openjdk/jdk/14405
(2 links to)