RFR: 8316397: StackTrace/Suspended/GetStackTraceSuspendedStressTest.java failed with: SingleStep event is NOT expected [v3]
Serguei Spitsyn
sspitsyn at openjdk.org
Thu Feb 20 21:48:28 UTC 2025
> The JVMTI functions `SuspendThread()`, `SuspendThreadList()` and `SuspendAllVirtualThreads()` use the runtime `HandshakeState::suspend()` function `SuspendThreadHandshake` class to suspend the `JavaThread` of a mounted virtual thread. They work under protection of the `JvmtiVTMSTransitionDisabler` to make the association of virtual thread with `JavaThread` stable. The function `HandshakeState::suspend()` creates an instance of`SuspendThreadHandshake`, executes it synchronously and then just returns. The `SuspendThreadHandshake:: do_thread()` in its order create an instance of the `ThreadSelfSuspensionHandshake` (which is a subclass of the `AsyncHandshakeClosure`) to force the handshakee's self-suspension asynchronously. The `HandshakeState::suspend()` does not wait for target thread real self-suspension, nor reaching a safe thread state that can be treated as a suspend-equivalent. This creates problems as the target virtual thread's activity can be observable after the JVMTI `Suspe
ndThread()` and others are returned. For instance, some `SingleStep` events can be posted.
> The fix is to wait in the `HandshakeState::suspend()` for the target handshakee to reach a safe thread state. This is done for the virtual thread case only. The suspension of normal platform threads remains the same.
>
> Testing:
> - Ran mach5 tiers 1-6
Serguei Spitsyn has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
- Merge
- removed obsolete fragment that was not removed in last update
- review: re-fixed the issue as initial fix was wrong
- 8316397: StackTrace/Suspended/GetStackTraceSuspendedStressTest.java failed with: SingleStep event is NOT expected
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/23490/files
- new: https://git.openjdk.org/jdk/pull/23490/files/c36f3188..d2b76873
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=23490&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=23490&range=01-02
Stats: 24357 lines in 1136 files changed: 15711 ins; 4551 del; 4095 mod
Patch: https://git.openjdk.org/jdk/pull/23490.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/23490/head:pull/23490
PR: https://git.openjdk.org/jdk/pull/23490
More information about the hotspot-runtime-dev
mailing list