Skip to content

Conversation

dholmes-ora
Copy link
Member

@dholmes-ora dholmes-ora commented May 31, 2023

The fix for JDK-8308341 overlooked the fact that during VM initialization agents can run and create native threads that will attach to (and potentially detach from) the VM. The check that VM init was complete before allowing those operations was too strong and has to be reverted. All the guards, except for that of GetCreatedJavaVMs itself, is reverted to the way it was before JDK-8308341.

Testing: tiers 1-4 (in progress)

Thanks.


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-8309171: Test vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/TestDescription.java fails after JDK-8308341

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 14239

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/14239.diff

Webrev

Link to Webrev Comment

…05t001/TestDescription.java fails after JDK-8308341
@bridgekeeper
Copy link

bridgekeeper bot commented May 31, 2023

👋 Welcome back dholmes! 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 May 31, 2023
@openjdk
Copy link

openjdk bot commented May 31, 2023

@dholmes-ora The following label will be automatically applied to this pull request:

  • hotspot

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

@openjdk openjdk bot added the hotspot hotspot-dev@openjdk.org label May 31, 2023
@mlbridge
Copy link

mlbridge bot commented May 31, 2023

Webrevs

Copy link
Member

@dcubed-ojdk dcubed-ojdk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thumbs up. The fix appears to do exactly what you described in the bug report.
Hopefully your in process testing goes well.

@openjdk
Copy link

openjdk bot commented May 31, 2023

@dholmes-ora This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8309171: Test vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/TestDescription.java fails after JDK-8308341

Reviewed-by: dcubed, gziemski

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 31, 2023
@azvegint
Copy link
Member

Please note that the associated test is now in the problem list, see #14250

@dcubed-ojdk
Copy link
Member

vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/TestDescription.java
has been ProblemListed. Please update this PR and restore the previous entry for
vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/TestDescription.java
before integrating this fix.

The previous entry looked like this:

vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/TestDescription.java 8219652 aix-ppc64

@AlanBateman
Copy link
Contributor

I skimmed through the JVMTI spec and I don't see anything to set expectations that a thread can potentially JNI attach before the "live phase". However, once the VM is in the live phase and the VMInit callback is invoked then it's game on. This makes me wonder if VM_Creation_State needs an additional state between IN_PROGRESS and CREATED to indicate that the VM is initialized so IN_PROGRESS -> "new-state" in Threads::create_vm and before JvmtiExport::post_vm_initialized, and "nw-state" -> CREATED when Threads::create_vm completes. That would prevent JNI attach before entering the live phase.

Copy link

@gerard-ziemski gerard-ziemski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks to me like the places you touched here are equivalent to the way it used to be originally.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label May 31, 2023
@gerard-ziemski
Copy link

If we could lock the VM init section, then any thread trying to do anything that depended on VM to be initialized, would just sit waiting till the VM is ready...

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 31, 2023
@dholmes-ora
Copy link
Member Author

Thanks for the reviews @dcubed-ojdk and @gerard-ziemski !

I have address the indentation issue and removed the recently added ProblemList entry.

@AlanBateman perhaps we should look further at the "live phase" but I don't think this is inherently tied to JVMTI. In theory the core libs could create a native thread that wants to attach during VM init. Either way I'm reluctant to introduce any change in behaviour other than that which was needed to fix the GetCreatedJavaVMs related crash. But I can file a RFE to look at this.

/integrate

@openjdk
Copy link

openjdk bot commented May 31, 2023

Going to push as commit 0119969.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 31, 2023
@openjdk openjdk bot closed this May 31, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 31, 2023
@openjdk
Copy link

openjdk bot commented May 31, 2023

@dholmes-ora Pushed as commit 0119969.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@dholmes-ora dholmes-ora deleted the 8309171-attach-failure branch May 31, 2023 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

5 participants