Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

8286836: Crash in GetSetLocalTest: No support for deferred values in continuations #41

Closed
wants to merge 1 commit into from

Conversation

sspitsyn
Copy link

@sspitsyn sspitsyn commented Jun 18, 2022

The JVMTI SetLocalXXX requires the target virtual thread suspended at a breakpoint or single step event.

This is the relevant statement from the "Local Variable" section:

The SetLocalXXX functions may be used to set the value of a local variable in the topmost frame of a virtual thread suspended at a breakpoint or single step event.

This fix is to return the JVMTI_ERROR_OPAQUE_FRAME in cases when the target thread is not at a breakpoint or single step event. In this case the assert described in the bug report is avoided:

open/src/hotspot/share/runtime/vframe.cpp:300
# assert(stack_chunk() == __null) failed: Not supported for heap frames 

Also, this is an analysis from Ron:

The problem occurs because the thread is suspended at a safepoint poll on return in the oldest thawed frame. The safepoint happens after the frame is popped but before it returns to the return barrier, thawing the caller (and so the stack looks as if we're in enterSpecial). In that case the virtual thread's topmost frame is still frozen on the heap, even though it is mounted.

However, the spec says that a set local operation should succeed for the topmost frame of a mounted virtual thread only if the thread is suspended *at a breakpoint or a single-step event*, and I don't think we can stop at that safepoint in that case.

If so, the fix is simple: if we're trying to set, even if the virtual thread is mounted and the depth is zero, if the frame is a heap frame, we should return an OPAQUE_FRAME error. The test should be changed as well to accept such an error if the thread is suspended not at a breakpoint/single-step. 

Changes GetSetLocalTest test are taken from the repo-loom repository. It was an update from Leonid which is needed to reproduce this problem.

The fix was tested with thousands of runs of the GetSetLocalTest on Linux, Windows and MacOs.

Will also submit nsk.jvmti and nsk.jdi test runs on mach5.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8286836: Crash in GetSetLocalTest: No support for deferred values in continuations

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk19 pull/41/head:pull/41
$ git checkout pull/41

Update a local copy of the PR:
$ git checkout pull/41
$ git pull https://git.openjdk.org/jdk19 pull/41/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 41

View PR using the GUI difftool:
$ git pr show -t 41

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk19/pull/41.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 18, 2022

👋 Welcome back sspitsyn! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 18, 2022
@openjdk
Copy link

openjdk bot commented Jun 18, 2022

@sspitsyn The following labels will be automatically applied to this pull request:

  • hotspot
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added serviceability serviceability-dev@openjdk.org hotspot hotspot-dev@openjdk.org labels Jun 18, 2022
@mlbridge
Copy link

mlbridge bot commented Jun 18, 2022

Webrevs

@sspitsyn sspitsyn closed this Jun 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
hotspot hotspot-dev@openjdk.org rfr Pull request is ready for review serviceability serviceability-dev@openjdk.org
1 participant