Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8245923

JDI and JDWP ThreadReference::stop should only allow ThreadDeath

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Withdrawn
    • Fix Version/s: 15
    • Component/s: core-svc
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      binary
    • Compatibility Risk:
      low
    • Compatibility Risk Description:
      Hide
      The JDI ThreadReference.stop method and JDWP StopThread command is a rarely used debugging feature. It is normally used to kill the specified thread with an instance of the exception ThreadDeath. This update requires an asynchronous exception to be always the ThreadDeath.
      Show
      The JDI ThreadReference.stop method and JDWP StopThread command is a rarely used debugging feature. It is normally used to kill the specified thread with an instance of the exception ThreadDeath. This update requires an asynchronous exception to be always the ThreadDeath.
    • Interface Kind:
      Java API, File or wire format

      Description

      Summary

      The JDWP ThreadReference::Stop command and JDI ThreadReference::stop method should follow the JVMTI StopThread spec and disallow an arbitrary Throwable from being passed, and instead restrict the argument to being an instance of ThreadDeath.

      Problem

      The spec of JDWP ThreadReference::Stop command and JDI ThreadReference::stop method do no match the JVM TI StopThread spec.

      Solution

      The exception argument of JDWP ThreadReference::Stop command and JDI ThreadReference::stop method has to be restricted to be an instance of ThreadDeath.

      Specification

      I. The following changes are needed in the JDWP ThreadReference::Stop comand spec:

      1. In the command description replace:

        This object must be an instance of java.lang.Throwable or a subclass

        with:

        This object must be an instance of java.lang.ThreadDeath.
      2. Add new error to the command Error Data section:

        ILLEGAL_ARGUMENT: If throwable is not an instance of java.lang.ThreadDeath.

      II. The following changes are needed in the JDI ThreadReference::stop method spec:

      1. In the method description replace:

        A debugger thread in the target VM will stop
        this thread with the given Throwable object.

        with:

        A debugger thread in the target VM will stop
        this thread with the given Throwable object,
        an instance of exception java.lang.ThreadDeath.
      2. In the section "Parameters:" replace:

        throwable - the asynchronous exception to throw.

        with:

        throwable - the asynchronous exception to throw,
        an instance of exception java.lang.ThreadDeath.
      3. In the In the section "Throws:" add new exception:

        IllegalArgumentException if throwable is not an instance of
        java.lang.ThreadDeath in the target VM.

      The updated JDWP ThreadReference::Stop command spec:

      http://cr.openjdk.java.net/~sspitsyn/webrevs/2020/jdwp-stop-thread.1/docs/specs/jdwp/jdwp-protocol.html#JDWP_ThreadReference_Stop

      The updated JDI ThreadReference::stop method spec:

      http://cr.openjdk.java.net/~sspitsyn/webrevs/2020/jdwp-stop-thread.1/docs/api/jdk.jdi/com/sun/jdi/ThreadReference.html#stop(com.sun.jdi.ObjectReference)

      Webrev:

      http://cr.openjdk.java.net/~sspitsyn/webrevs/2020/jdwp-stop-thread.1/src/

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sspitsyn Serguei Spitsyn
                Reporter:
                sspitsyn Serguei Spitsyn
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: