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

[JDK20/21] Add support for JVMTI Local Variable functions #17829

Merged

Conversation

babsingh
Copy link
Contributor

Since JDK20, all JVMTI Local Variable functions are expected to return
JVMTI_ERROR_THREAD_NOT_SUSPENDED if the thread was not suspended and
was not the current thread.

Also, there is no need to halt and resume the thread for inspection
since these functions expect the thread to be suspended.

Related: #17711

Since JDK20, all JVMTI Local Variable functions are expected to return
JVMTI_ERROR_THREAD_NOT_SUSPENDED if the thread was not suspended and
was not the current thread.

Also, there is no need to halt and resume the thread for inspection
since these functions expect the thread to be suspended.

Related: eclipse-openj9#17711

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
@babsingh
Copy link
Contributor Author

Timeline to illustrate change in JVMTI spec behaviour

JDK8 - https://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html#local
JDK19 - https://download.java.net/java/early_access/jdk19/docs/specs/jvmti.html#local

  • The below error code was added to all Local Variable functions in JDK20.
  • JVMTI_ERROR_THREAD_NOT_SUSPENDED: Thread was not suspended and was not the current thread.

JDK20 - https://docs.oracle.com/en/java/javase/20/docs/specs/jvmti.html#local
JDK21 - https://download.java.net/java/early_access/jdk21/docs/specs/jvmti.html#local

@babsingh
Copy link
Contributor Author

@gacholio Requesting your review.

@babsingh babsingh requested a review from gacholio July 20, 2023 15:15
@gacholio
Copy link
Contributor

This does not address being suspended by java. In the past, suspension by java or JVMTI was indistiguishable (making the whole thing extremely unreliable). Please verify that the two are still identical for normal threads, which would require changes to this PR.

@gacholio
Copy link
Contributor

Are suspend and resume even legal in java in the latest releases?

@babsingh
Copy link
Contributor Author

Are suspend and resume even legal in java in the latest releases?

Since JDK20, java.lang.Thread.resume and java.lang.Thread.suspend throw UnsupportedOperationException for both normal and virtual threads.

This does not address being suspended by java. In the past, suspension by java or JVMTI was indistiguishable (making the whole thing extremely unreliable). Please verify that the two are still identical for normal threads, which would require changes to this PR.

In JDK20+, suspend and resume are only possible through JVMTI; the Java methods just return UnsupportedOperationException.

@gacholio
Copy link
Contributor

jenkins test sanity zlinux jdk8,jdk21

@gacholio
Copy link
Contributor

There's rather a lot of failures in the JDK21 testing.

@pshipton
Copy link
Member

I only see one failure in testJitserverArguments_0 due to "Connection refused", which seems unrelated to this change.

@gacholio
Copy link
Contributor

Yes, I'm misreading the output.

@gacholio gacholio merged commit 0f4d0b5 into eclipse-openj9:master Jul 21, 2023
babsingh added a commit to babsingh/aqa-tests that referenced this pull request Jul 25, 2023
- StopThreadTest fixed by eclipse-openj9/openj9#17806
- PopFrameTest fixed by eclipse-openj9/openj9#17809
- GetSetLocalUnsuspended fixed by eclipse-openj9/openj9#17829

Closes eclipse-openj9/openj9#17711
Closes eclipse-openj9/openj9#17715
Closes eclipse-openj9/openj9#17716
Closes eclipse-openj9/openj9#17717
Closes eclipse-openj9/openj9#17718

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
babsingh added a commit to babsingh/aqa-tests that referenced this pull request Jul 25, 2023
- StopThreadTest is fixed by eclipse-openj9/openj9#17806.
- PopFrameTest is fixed by eclipse-openj9/openj9#17809.
- GetSetLocalUnsuspended is fixed by eclipse-openj9/openj9#17829.

Closes eclipse-openj9/openj9#17711
Closes eclipse-openj9/openj9#17715
Closes eclipse-openj9/openj9#17716
Closes eclipse-openj9/openj9#17717
Closes eclipse-openj9/openj9#17718

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
llxia pushed a commit to adoptium/aqa-tests that referenced this pull request Jul 25, 2023
- StopThreadTest is fixed by eclipse-openj9/openj9#17806.
- PopFrameTest is fixed by eclipse-openj9/openj9#17809.
- GetSetLocalUnsuspended is fixed by eclipse-openj9/openj9#17829.

Closes eclipse-openj9/openj9#17711
Closes eclipse-openj9/openj9#17715
Closes eclipse-openj9/openj9#17716
Closes eclipse-openj9/openj9#17717
Closes eclipse-openj9/openj9#17718

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants