On Wed, 13 Sep 2023 12:47:48 GMT, Alan Bateman <al...@openjdk.org> wrote:
>> This PR includes a couple of clarifications of the JDWP and JDI invoke >> method support. The first is that deadlocks can occur due to a needed >> "resource" being held. The spec previously just mentioned monitors being >> held, but this is too specific. The second is to clarify that an invoke on a >> virtual thread can be more prone to deadlocks than a platform thread may be. >> >> I did a doc build you can look at to view the changes. Links to the relevant >> sections are below: >> >> https://cr.openjdk.org/~cjplummer/8301639/docs.00/specs/jdwp/jdwp-protocol.html#JDWP_ClassType_InvokeMethod >> >> https://cr.openjdk.org/~cjplummer/8301639/docs.00/specs/jdwp/jdwp-protocol.html#JDWP_ClassType_NewInstance >> >> https://cr.openjdk.org/~cjplummer/8301639/docs.00/specs/jdwp/jdwp-protocol.html#JDWP_InterfaceType_InvokeMethod >> >> https://cr.openjdk.org/~cjplummer/8301639/docs.00/specs/jdwp/jdwp-protocol.html#JDWP_ObjectReference_InvokeMethod >> >> https://cr.openjdk.org/~cjplummer/8301639/docs.00/api/jdk.jdi/com/sun/jdi/ClassType.html#invokeMethod(com.sun.jdi.ThreadReference,com.sun.jdi.Method,java.util.List,int) >> >> https://cr.openjdk.org/~cjplummer/8301639/docs.00/api/jdk.jdi/com/sun/jdi/ClassType.html#newInstance(com.sun.jdi.ThreadReference,com.sun.jdi.Method,java.util.List,int) >> >> https://cr.openjdk.org/~cjplummer/8301639/docs.00/api/jdk.jdi/com/sun/jdi/InterfaceType.html#invokeMethod(com.sun.jdi.ThreadReference,com.sun.jdi.Method,java.util.List,int) >> >> https://cr.openjdk.org/~cjplummer/8301639/docs.00/api/jdk.jdi/com/sun/jdi/ObjectReference.html#invokeMethod(com.sun.jdi.ThreadReference,com.sun.jdi.Method,java.util.List,int) > > src/java.se/share/data/jdwp/jdwp.spec line 1150: > >> 1148: "suspended by an event or by command. " >> 1149: "This is done to prevent the deadlocks " >> 1150: "that will occur if any of the threads own resources, such as >> monitors, " > > In passing, shouldn't that be "may occur" rather than the "will occur"? (the > full context isn't visible here so it's hard to see). No, because the line below follows with "...that _will_ be needed by the invoked method". If the resource _will_ be needed, then the deadlock _will_ occur. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15695#discussion_r1324741135