-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
8310829: guarantee(!HAS_PENDING_EXCEPTION) failed in ExceptionTranslation::doit #14641
Conversation
…Translation::doit
👋 Welcome back dnsimon! A progress list of the required criteria for merging this PR into |
@dougxc The following labels 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 lists. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
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 eager loading seems reasonable, but I do not understand the details here. In what way was loading failing? You still have to initialize VMSupport
before you can call methods on it, so that could also fail - though the code does not seem to notice/handle this. ??
@@ -582,7 +582,7 @@ C2V_VMENTRY_NULL(jobject, lookupType, (JNIEnv* env, jobject, jstring jname, ARGU | |||
TempNewSymbol class_name = SymbolTable::new_symbol(str); | |||
|
|||
if (class_name->utf8_length() <= 1) { | |||
JVMCI_THROW_MSG_0(InternalError, err_msg("Primitive type %s should be handled in Java code", class_name->as_C_string())); | |||
JVMCI_THROW_MSG_0(InternalError, err_msg("Primitive type %s should be handled in Java code", str)); |
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.
Seems unrelated to the fix at hand.
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.
Yes, it's a minor fix up I noticed while making changes a few lines below. It just avoids a conversion of a Symbol
back to a C string when the original C string is available.
The failure was due to |
Sure but my point is that initialization can fail and the code does not seem to directly take that into account - if the first |
Edited above to correct: I think it is just highlighting that this code is not prepared for "system" errors like this. |
That's fine - if VMSupport fails class initialization, then no "rich" decoding can occur (by definition) and so throwing the clinit error is the best we can do.
You have to keep in mind that |
BTW, I've manually tested this with libgraal. It's not possible to add a jtreg test until libgraal in part of OpenJDK. |
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 ok to me.
@dougxc 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 11 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 |
Then why did you not simply handle the exception from the loading of VMSupport the same way? |
The only actual case seen of the original way failing is due to OOME in GC stress tests. If loading of VMSupport is done during VM startup, then no stress test code can cause an OOME while loading VMSupport. I doubt |
I would think it is likely to fail with OOME under the same GC stress test conditions. But if this is just a stress test issue then bailing out when the loading fails would be far simpler than pre-loading the class. You've added to the VM startup cost just to avoid a stress test failure. |
Any app running near the GC limit can cause this and we've seen this with libgraal in practice. When the VM is near the GC limit, any compilation can cause an OOME and then when that OOME wants to be translated back to libgraal, it can be the first time VMSupport is used.
|
It may be in the noise but noise adds up over time. It just seems to me that the simplest fix here would have been to convert
to
and just return on exception. A very isolated change with zero impact on anything else. |
I've pushed the loading of |
I don't think pushing it down that far improves things. encode always precedes decode so why not resolve it before the encode call.
|
src/hotspot/share/jvmci/jvmciEnv.cpp
Outdated
return; | ||
} | ||
int res = encode(THREAD, vmSupport, buffer, buffer_size); | ||
int res = encode(THREAD, buffer, buffer_size); | ||
if (_from_env != nullptr && !_from_env->is_hotspot() && _from_env->has_pending_exception()) { |
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.
Why is this check before the HAS_PENDING_EXCEPTION
check? Couldn't you end up returning with a pending exception in this path?
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.
If encode
is SharedLibraryToHotSpotExceptionTranslation::encode
there is no possibility of a pending HotSpot exception upon it returning. If it's HotSpotToSharedLibraryExceptionTranslation::encode
then _from_env->is_hotspot()
is true
and so this if
branch is not taken.
Because the |
Right, I was forgetting about the virtual nature of this code. Why can't the pending exception handling be in the respective virtual? The partition between virtual and shared is kind of ugly. |
Done: 9236128 |
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.
That's more clear to me. Thanks!
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 now isolated to JVMCI code that I'm not familiar with, so don't feel competent to review. The general idea seems okay but I'm not familiar enough with the details. Someone from the compiler team should review this now.
Thanks.
@vnkozlov could you please review this or nominate someone else from the compiler team to look at it. Thanks. |
I am fins with idea of changes. But, please, activate GHA testing for this branch.
|
I have fixed the warning on Windows: 5bb3b52
Isn't GHA a strict subset of or equal to tier1 mach5 testing? If so, what's the point of doing redundant testing? |
It builds and tests configurations (32-bit) we don't have in our testing. |
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.
Good.
Good to know - thanks! |
Thanks for the reviews. /integrate |
Going to push as commit f6bdccb.
Your commit was automatically rebased without conflicts. |
The VMSupport class is required for translating an exception between the HotSpot and libgraal heaps.
Loading it lazily can result in a loading exception, obscuring the exception being translated.
To avoid this, VMSupport is loaded eagerly along with the other vmClasses.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/14641/head:pull/14641
$ git checkout pull/14641
Update a local copy of the PR:
$ git checkout pull/14641
$ git pull https://git.openjdk.org/jdk.git pull/14641/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 14641
View PR using the GUI difftool:
$ git pr show -t 14641
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/14641.diff
Webrev
Link to Webrev Comment