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

ThreadReference.stop does not specify error/exception when virtual thread can't throw async exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 19
    • core-svc

      The JDWP ThreadReference/Stop command includes the following in its specification:

      "The target VM may not support, or may only provide limited support, for stopping a virtual thread with an asynchronous exception. It may, for example, only support this operation when the virtual thread is suspended at a breakpoint or singlestep event."

      but the command does not specify the JDWP error that is returned when the target VM does support the command but a virtual thread cannot be stopped for some reason (state, not suspended, ...).

      The com.sun.jdi.ThreadReference.stop API is similar:

      "The target VM may not support, or may only provide limited support, for stopping a virtual thread with an asynchronous exception. It may, for example, only support this operation when the virtual thread is suspended at a breakpoint or singlestep event."

      but the method doesn't specify the exception thrown when the target VM supports "stop" but the virtual thread is not in the right "state". It may be that IllegalThreadStateException is the appropriate exception to throw.

      The spec of this command and method needs to be re-examined to avoid incompatible changes in the future when support for stopping a virtual thread with an asynchronous exception is added.

            cjplummer Chris Plummer
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: