JDK-8306467 : Fix nsk/jdb/kill/kill001 to work with new JVMTI StopThread support for virtual threads.
  • Type: Bug
  • Component: core-svc
  • Sub-Component: debugger
  • Affected Version: 21
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-04-19
  • Updated: 2023-05-22
  • Resolved: 2023-05-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 21
21 b23Fixed
Related Reports
Relates :  
Relates :  
Description
Currently kill001 assumes that JVMTI StopThread (via JDI ThreadReference.stop) is not supported for virtual threads. JDK-8306034 is adding support for StopThread on a virtual thread as long as it is suspended and mounted. This means, for example, it will work for virtual threads in the following conditions:
-Debuggee in a loop and suspended
-Debuggee at a breakpoint and suspended

But will continue to not work in the following situations:
-Debuggee in a loop but not suspended
-Debuggee suspended but unmounted, such as during a call the Thread.sleep()

kill001 suspends all threads at a breakpoint and then does a "jdb kill" on each thread, which translate to ThreadReference.stop(), so this should be expected to work now.

Most of the changes involve undoing the virtual thread specific code that was added to the test as part of JDK-8282385. However, there is an additional issue that also needs fixing. The test relies on the fact that the async exception is normally not caught, and that jdb normally stops when an uncaught exception is thrown. With virtual threads there ends up being an exception handler in java.lang.VirtualThread.run(), resulting in jdb not stopping when the async exception is thrown. This can be fixed by having the test issue a jdb "catch all <classname>" command for each async exception type that the test throws.

Comments
Changeset: 64d51571 Author: Chris Plummer <cjplummer@openjdk.org> Date: 2023-05-16 17:02:12 +0000 URL: https://git.openjdk.org/jdk/commit/64d51571166e69f724c6329f4a4c23be143e7f95
16-05-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/13967 Date: 2023-05-12 20:58:31 +0000
12-05-2023