-
Notifications
You must be signed in to change notification settings - Fork 706
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
Fix stackwalk related jvmti functions #15872
Fix stackwalk related jvmti functions #15872
Conversation
In some cases the J9VMContinuation cannot be accessed through a j9object so we change the parameter of walkContinuationStackFrames to accept a J9VMContinuation pointer directly. Adds declaration of J9VMContinuation to the top. Signed-off-by: Gengchen Tuo <gengchen.tuo@ibm.com>
@fengxue-IS @babsingh FYI |
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.
LGTM
55dff18
to
104f071
Compare
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.
Can you confirm that all previous testing on the updated APIs also pass
ie. https://github.com/ibmruntimes/openj9-openjdk-jdk19/tree/openj9/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace
https://github.com/ibmruntimes/openj9-openjdk-jdk19/tree/openj9/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameCount/framecnt01
Yes I've run the GetFrameCount, GetFrameLocation, and GetStackTrace tests, all the results stayed the same. |
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.
Minor formatting nitpicks. Plan to launch PR builds after this.
104f071
to
b675167
Compare
fixed |
b675167
to
28e580c
Compare
28e580c
to
5dd731b
Compare
5dd731b
to
7424564
Compare
jenkins test sanity win,xlinux jdk19 |
jenkins test sanity amac jdk11 |
There are compilation errors in the PR builds. All invocations of |
7424564
to
dee2fbb
Compare
Should be fixed now, but not sure if |
No. See https://download.java.net/java/early_access/jdk19/docs/specs/jvmti.html#GetAllStackTraces. As per the JVMTI doc, it should "get the stack traces of all live platform threads attached to the VM ... It does not include the stack traces of virtual threads". openj9/runtime/jvmti/jvmtiThread.c Lines 163 to 170 in df2f3a3
|
dee2fbb
to
c0f79e5
Compare
jenkins test sanity amac jdk11 |
jenkins test sanity win,xlinux jdk19 |
c0f79e5
to
cbf13cb
Compare
jenkins test sanity amac jdk11 |
jenkins test sanity win,xlinux jdk19 |
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 should fix the recent crash. As per the JVMTI doc, the current thread should be used if the input thread is null. See the JVMTI doc for the three impacted functions:
In the old implementation, if a carrier thread has a virtual thread mounted after getVMThread being called, the virtual thread will be walked. We fix this by adding a check for currentContinuation of the carrier thread. If the currentContinuation is not null, the info of the carrier thread has been swapped to the currentContinuation, so the currentContinuation will be walked instead. To facilitate other stackwalk-related functions, a generic stackwalk helper is added to walk a platform thread or a virtual thread. A virtual can be mounted or unmounted, if it's mounted, the carrier thread is walked, otherwise the continuation object is walked. For a platform thread, if the currentContinuation is not null, the currentContinuation will be walked, otherwise the thread is walked. Signed-off-by: Gengchen Tuo <gengchen.tuo@ibm.com>
cbf13cb
to
e601745
Compare
Fixed |
jenkins test sanity amac jdk11 |
jenkins test sanity win,xlinux jdk19 |
In some cases the J9VMContinuation cannot be accessed through a j9object so we change the parameter of walkContinuationStackFrames to accept a J9VMContinuation pointer directly.
Adds declaration of J9VMContinuation to the top.
In the old implementation, if a carrier thread has a virtual thread mounted after getVMThread being called, the virtual thread will be walked. We fix this by adding a check for currentContinuation of the carrier thread. If the currentContinuation is not null, the info of the carrier thread has been swapped to the currentContinuation, so the
currentContinuation will be walked instead.
To facilitate other stackwalk-related functions, a generic stackwalk helper is added to walk a platform thread or a virtual thread. A virtual can be mounted or unmounted, if it's mounted, the carrier thread is walked, otherwise the continuation object is walked. For a platform thread, if the currentContinuation is not null, the currentContinuation will be walked, otherwise the thread is walked.
Signed-off-by: Gengchen Tuo gengchen.tuo@ibm.com