Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8267796: vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/TestDescription.java fails with NoClassDefFoundError #7607

Closed
wants to merge 3 commits into from

Conversation

alexmenkov
Copy link

@alexmenkov alexmenkov commented Feb 24, 2022

The fix adds workaround in hs201t001a class like we have in hs201t001 test to avoid class loading while the test do single stepping/pop frame.
Also fixed a number of issues in the test.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8267796: vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/TestDescription.java fails with NoClassDefFoundError

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7607/head:pull/7607
$ git checkout pull/7607

Update a local copy of the PR:
$ git checkout pull/7607
$ git pull https://git.openjdk.java.net/jdk pull/7607/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 7607

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7607.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 24, 2022

👋 Welcome back amenkov! 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
Copy link

openjdk bot commented Feb 24, 2022

@alexmenkov The following label will be automatically applied to this pull request:

  • serviceability

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 serviceability serviceability-dev@openjdk.org label Feb 24, 2022
@@ -71,7 +71,7 @@
* newclass
*
* @run main/othervm/native
* -agentlib:hs201t002=pathToNewByteCode=./bin,-waittime=5
* nsk.jvmti.scenarios.hotswap.HS201.hs201t002
* -agentlib:hs201t002=pathToNewByteCode=./bin,-waittime=5,-verbose
Copy link
Author

Choose a reason for hiding this comment

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

Adds verbose output for the test and agent

@@ -45,16 +45,12 @@ static jlong timeout = 0;
#define PATH_TO_NEW_BYTECODE "pathToNewByteCode"

static jint testStep;
static int redefineNumber;
Copy link
Author

Choose a reason for hiding this comment

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

not used

}

if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) {
nsk_jvmti_setFailStatus();
}
if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate(newClassBytes))) {
Copy link
Author

Choose a reason for hiding this comment

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

proper resource deallocation

jclass klass;

NSK_DISPLAY2("\n\n>>>> Exception %s in thread - %s\n",
Copy link
Author

Choose a reason for hiding this comment

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

getClassName() and getThreadName() used the same global buffer to return results. So thread name overrides class name and in log we see:

Exception hs201t002Thread in thread - hs201t002Thread
instead of
Exception Lnsk/jvmti/scenarios/hotswap/HS201/hs201t002a; in thread - hs201t002Thread

@@ -377,7 +379,7 @@ callbackExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,

/* ============================================================================= */

int readNewBytecode(jvmtiEnv* jvmti) {
int readNewBytecode(jvmtiEnv* jvmti, jint &newClassSize, unsigned char* &newClassBytes) {
Copy link
Author

Choose a reason for hiding this comment

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

The function returns loaded data instead of using global variable for correct resource management

@@ -422,68 +426,61 @@ int readNewBytecode(jvmtiEnv* jvmti) {

/* ============================================================================= */

const char* getThreadName(JNIEnv* jni_env, jthread thread) {
const char* getThreadName(jvmtiEnv* jvmti_env, JNIEnv* jni_env, jthread thread) {
Copy link
Author

Choose a reason for hiding this comment

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

The function now returns JVMTI allocated buffer instead of global buffer


jni_env->ReleaseStringUTFChars(jthreadName, threadName);

return chbuffer;
return (char*)result;
}

/* ============================================================================= */

const char* getClassName(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jobject object) {
Copy link
Author

Choose a reason for hiding this comment

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

The function now returns JVMTI allocated buffer instead of global buffer

@@ -665,11 +666,6 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {

NSK_DISPLAY0("Enable events\n");

enableEvent(jvmti, JVMTI_EVENT_CLASS_LOAD, testedThread);
Copy link
Author

Choose a reason for hiding this comment

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

This code executed on agent initialization, the test has no chance to set testThread.
Moved to hs201t002.setThread()

@@ -26,6 +26,7 @@
public class hs201t002a extends Exception {

public hs201t002a () {
System.out.println("Current step: " + hs201t002.currentStep); // Avoid calling classloader to find hs201t002 in doInit()
Copy link
Author

Choose a reason for hiding this comment

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

This is the fix for the failure, the rest are test improvements

@alexmenkov alexmenkov marked this pull request as ready for review February 24, 2022 13:22
@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 24, 2022
@mlbridge
Copy link

mlbridge bot commented Feb 24, 2022

Webrevs

Copy link
Contributor

@kevinjwalls kevinjwalls left a comment

Choose a reason for hiding this comment

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

Looks like a good improvement.

@openjdk
Copy link

openjdk bot commented Mar 1, 2022

@alexmenkov 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:

8267796: vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/TestDescription.java fails with NoClassDefFoundError

Reviewed-by: kevinw, cjplummer

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 267 new commits pushed to the master branch:

  • 732d891: 8282411: Add useful predicates to ElementKind
  • eac8021: 8282320: Remove case conversion for debugging log in SSLCipher
  • b86a8c0: 8282150: Drop redundant
    elements from tables in java.desktop HTML files
  • 941e97c: 8281738: Create a regression test for checking the 'Space' key activation of focused Button
  • 8fec7b8: 8281548: Add escape analysis tracing flag
  • b03d66c: 8282452: Use of Preview API in preview methods should not trigger preview warning for the enclosing class
  • 76398c8: 8279573: compiler/codecache/CodeCacheFullCountTest.java fails with "RuntimeException: the value of full_count is wrong."
  • 31b61f9: 8282311: Fix a typo in javax.lang.model.type.NullType
  • 2c5d266: 8282045: When loop strip mining fails, safepoints are removed from loop anyway
  • 341c8bd: 8267834: Refactor G1CardSetAllocator and BufferNode::Allocator to use a common base class
  • ... and 257 more: https://git.openjdk.java.net/jdk/compare/46c6c6f308b5ec0ec3b762df4b76de555287474c...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this 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 Mar 1, 2022
@alexmenkov
Copy link
Author

/integrate

@openjdk
Copy link

openjdk bot commented Mar 2, 2022

Going to push as commit f12200c.
Since your change was applied there have been 270 commits pushed to the master branch:

  • 12a822a: 8282381: Parallel: Remove unnecessary PCReferenceProcessor
  • ed3496e: 8282480: IGV: Use description instead of enum name for phases
  • fc52a21: 8282143: Objects.requireNonNull should be ForceInline
  • 732d891: 8282411: Add useful predicates to ElementKind
  • eac8021: 8282320: Remove case conversion for debugging log in SSLCipher
  • b86a8c0: 8282150: Drop redundant
    elements from tables in java.desktop HTML files
  • 941e97c: 8281738: Create a regression test for checking the 'Space' key activation of focused Button
  • 8fec7b8: 8281548: Add escape analysis tracing flag
  • b03d66c: 8282452: Use of Preview API in preview methods should not trigger preview warning for the enclosing class
  • 76398c8: 8279573: compiler/codecache/CodeCacheFullCountTest.java fails with "RuntimeException: the value of full_count is wrong."
  • ... and 260 more: https://git.openjdk.java.net/jdk/compare/46c6c6f308b5ec0ec3b762df4b76de555287474c...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Mar 2, 2022

@alexmenkov Pushed as commit f12200c.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

3 participants