-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Conversation
👋 Welcome back amenkov! A progress list of the required criteria for merging this PR into |
@alexmenkov The following label will be automatically applied to this pull request:
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. |
@@ -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 |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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))) { |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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
Webrevs
|
test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002.java
Outdated
Show resolved
Hide resolved
test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp
Outdated
Show resolved
Hide resolved
test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp
Outdated
Show resolved
Hide resolved
test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/TestDescription.java
Show resolved
Hide resolved
There was a problem hiding this 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.
@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:
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
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 |
/integrate |
Going to push as commit f12200c.
Your commit was automatically rebased without conflicts. |
@alexmenkov Pushed as commit f12200c. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
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
Issue
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