RFR: 8306467: Fix nsk/jdb/kill/kill001 to work with new JVMTI StopThread support for virtual threads. [v2]
Alex Menkov
amenkov at openjdk.org
Mon May 15 21:16:52 UTC 2023
On Mon, 15 May 2023 20:10:08 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:
>> Currently kill001 assumes that JVMTI StopThread (via JDI ThreadReference.stop) is not supported for virtual threads. [JDK-8306034](https://bugs.openjdk.org/browse/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 is 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](https://bugs.openjdk.org/browse/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 is fixed by having the test issue a jdb "catch all <classname>" command for each async exception type that the test throws.
>
> Chris Plummer has updated the pull request incrementally with one additional commit since the last revision:
>
> fix issues in debuggee
Marked as reviewed by amenkov (Reviewer).
test/hotspot/jtreg/vmTestbase/nsk/jdb/kill/kill001/kill001.java line 150:
> 148: if (killed.length() > 0) {
> 149: if (killed.indexOf(DEBUGGEE_RESULT + " = " + numThreads) < 0) {
> 150: log.complain("Only " + killed + "out of " + numThreads + MYTHREAD + "s were killed.");
add space before "out of "?
test/hotspot/jtreg/vmTestbase/nsk/jdb/kill/kill001/kill001a.java line 156:
> 154: kill001a.waitnotify.notify();
> 155: }
> 156:
trailing whitespaces. jcheck failed.
-------------
PR Review: https://git.openjdk.org/jdk/pull/13967#pullrequestreview-1427373242
PR Review Comment: https://git.openjdk.org/jdk/pull/13967#discussion_r1194366264
PR Review Comment: https://git.openjdk.org/jdk/pull/13967#discussion_r1194367317
More information about the serviceability-dev
mailing list