Integrated: 8306471: Add virtual threads support to JDWP ThreadReference.Stop and JDI ThreadReference.stop()

Chris Plummer cjplummer at openjdk.org
Fri May 12 20:09:00 UTC 2023


On Wed, 19 Apr 2023 23:40:56 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

> [JDK-8306034](https://bugs.openjdk.org/browse/JDK-8306034) (#13546) added some virtual thread support to JVMTI StopThread. This allows JDWP ThreadReference.Stop and JDI ThreadReference.stop() to have the same level support for virtual threads.
> 
> For your reference, here are the JVMTI spec changes that this pr is using as the basis for the JDWP and JDI spec updates.
> 
> https://github.com/openjdk/jdk/pull/13546/files#diff-cab9797fde25f344784e4473778cd35bfd9e19ba36f82c11b1a0674636958339
> 
> Mostly this is a spec update for JDWP and JDI, but there are also some minor changes needed to the ThreadReference.stop() handling of JDWP errors, and throwing the appropriate exceptions. Also some minor cleanup in jdb. The debug agent doesn't need changes since JVMTI errors are just passed through as the corresponding JDWP errors, and the code for this is already in place. These errors are not new nor need any special handling.
> 
> Our existing testing for ThreadReference.stop() is fairly weak:
> 
> - nsk/jdb/kill/kill001, which tests stop() when the thread is suspended at a breakpoint. It will get problem listed by [JDK-8306034](https://bugs.openjdk.org/browse/JDK-8306034). I have fixes for it already working and will push it separately.
> - nsk/jdi/stop/stop001, which is problem listed and only tests when the thread is blocked in Object.wait()
> - nsk/jdi/stop/stop002, which only tests that throwing an invalid exception fails properly
> 
> I decided to take stop002 and make it a more thorough test of ThreadReference.stop(). See the comment at the top of the test for a list of what is tested. As for reviewing this test, it's probably best to look at it as a completely new test rather than looking at diffs since so much has been changed and added.

This pull request has now been integrated.

Changeset: d809823f
Author:    Chris Plummer <cjplummer at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/d809823fe486dfa0fe0bf1c3deff31e81bbc5f28
Stats:     368 lines in 7 files changed: 287 ins; 9 del; 72 mod

8306471: Add virtual threads support to JDWP ThreadReference.Stop and JDI ThreadReference.stop()

Reviewed-by: sspitsyn, alanb

-------------

PR: https://git.openjdk.org/jdk/pull/13548


More information about the serviceability-dev mailing list