-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8365192: post_meth_exit should be in vm state when calling get_jvmti_thread_state #26713
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
Conversation
|
👋 Welcome back lmesnik! A progress list of the required criteria for merging this PR into |
|
@lmesnik This change is no longer ready for integration - check the PR body for details. |
Webrevs
|
sspitsyn
left a comment
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.
Thank you for catching and addressing this! How was the fix tested?
It looks okay at a glance but may give surprises.
|
I ran tier1-5 testing and separately verified that test pass with jvmti strass agent. |
Okay, thanks. I'd also run the tier 6 to be more safe. |
sspitsyn
left a comment
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 good
test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/ExceptionOccurred.java
Outdated
Show resolved
Hide resolved
...spot/jtreg/serviceability/jvmti/events/MethodExit/ExceptionOccurred/libExceptionOccurred.cpp
Show resolved
Hide resolved
test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/ExceptionOccurred.java
Show resolved
Hide resolved
dholmes-ora
left a comment
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.
I'm very confused by this issue. The description indicates we are calling get_jvmti_thread_state from the wrong state, but nowhere here or in JBS do I see anything showing me the actual failing code path. JBS has a part of a hs_err file that reports "# fatal error: LEAF method calling lock? " but I don't see how that relates to the stated problem of being in the wrong state ??
Also you state post_method_exit is not called when the method terminates via an exception, but I can't see that as being the case. The MethodExit callback in JVMTI is called under all termination conditions and post_method_exit seems similarly unconditional. ??
test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/ExceptionOccurred.java
Show resolved
Hide resolved
test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/ExceptionOccurred.java
Outdated
Show resolved
Hide resolved
test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/ExceptionOccurred.java
Outdated
Show resolved
Hide resolved
...spot/jtreg/serviceability/jvmti/events/MethodExit/ExceptionOccurred/libExceptionOccurred.cpp
Show resolved
Hide resolved
…ptionOccurred.java Co-authored-by: David Holmes <62092539+dholmes-ora@users.noreply.github.com>
The comment in JBS shows the stacktrace from hs_err. I copied it here: Also, I updated another comment to show how to reproduce the bug. The testing is not integrated in CI yet. However, it could be reproduced using our tests. Also, the problem could be quite easy reproduced if assertion from the patch is added to
The method T |
Co-authored-by: David Holmes <62092539+dholmes-ora@users.noreply.github.com>
But nothing in that hs_err snippet indicates that the problem is we are in the wrong state.
Thanks for clarifying. I was looking at remove_activation in the interpreter and did not see any special exception processing path.
Still struggling with this part. So the method exited normally then as part of event processing a Java upcall can raise an exception? But according to the spec any such exceptions get dropped - so is the flag just to do the dropping? |
...spot/jtreg/serviceability/jvmti/events/MethodExit/ExceptionOccurred/libExceptionOccurred.cpp
Outdated
Show resolved
Hide resolved
…ptionOccurred/libExceptionOccurred.cpp Co-authored-by: David Holmes <62092539+dholmes-ora@users.noreply.github.com>
Vice versa. |
So the callback does an upcall that invokes the same method we are still posting the "method exit" for. That is a distinct frame/activation so the exit mode of the original should be immaterial. Though not sure how we avoid infinite loop in such a recursive case. |
|
To fix the actual, simple, problem of being in the wrong state, it seems to me that this earlier suggestion is far easier to understand: With the proposed deferral of the if we may not be in interp_only mode? If the concern is the overhead of |
|
I see that that I did this, and why I trying to understand what would be result in the case of So let me split this fix into 2 separate issues and fix them separately. I filed to don't change posting because of |
I think that once we transition to vm there is no point in going back to Java to then possibly transition back to vm. The only reason to delay the transition was to have the |
How does that relate to |
|
The |
|
@lmesnik this pull request can not be integrated into git checkout 8365192
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
The method
get_jvmti_thread_state()
should be called only while thread is in vm state.
The post_method_exit is doing some preparation before switching to vm state. This cause issues if thread is needed to initialize jvmti thread state.
The fix was found using jvmti stress agent and thus no additional regression test is required.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26713/head:pull/26713$ git checkout pull/26713Update a local copy of the PR:
$ git checkout pull/26713$ git pull https://git.openjdk.org/jdk.git pull/26713/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 26713View PR using the GUI difftool:
$ git pr show -t 26713Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26713.diff
Using Webrev
Link to Webrev Comment