-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8296709: WARNING: JNI call made without checking exceptions #11083
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 lucy! A progress list of the required criteria for merging this PR into |
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.
Looks good I think. Got to check for those exceptions!
The example invocation also shows the me "exceeds capacity" warning, which must relate to the above WITH_LOCAL_REFS and call to createLocalRefSpace. Another time maybe. 8-)
|
Thanks for the review, Kevin! |
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.
Thank you for taking care about this.
Serguei
|
@RealLucy 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 92 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 |
|
Can the test be augmented to catch this case too? |
David, |
|
Maybe you could also call "bin/java -Xcheck:jni -agentlib:jdwp=transport=dt_socket,server=y,suspend=n -version" which would show the error? Or add this as another test for serviceability? |
|
I was suggesting what @RealCLanger suggests in regards to the test - add a new case. |
Ahh, now I understand. I will add the suggested test modification to this PR. |
|
I've added a separate test which does the same but with an active jdwp agent. The test will fail until the warning |
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. I commented on two nits.
If you don't have a quick idea on how to fix WARNING: JNI local refs: 921, exceeds capacity: 32, you could open a bug for it (if there isn't one already) and right away exclude the test with reference to the new bug.
The alternative would be to filter out the local refs warning but then I guess this will be forgotten.
After all, either way is not perfect...
|
Couldn't you simply add a second |
Actually, I first did it that way. And I did not like it. It's not just the doExec, you need to duplicate the checks as well. So far, it's just personal preference. The test case with active jdwp agent produces two warnings, but I have a fix for only one of the warnings. @RealCLanger suggested to create a bug for the unresolved warning and problem-list the test case until the bug is fixed. If this is the way to go, I need a separate test file. |
Hm, I also don't like the code duplication... You could use 2 @run tags. Via the run tags you can create two runs of the test, one like the current "default" and antoher one passing the debugging agent option as additional parameter which you have to hand to the the java child process then, too. Generally you'd expect the same results, e.g. good return code, the hello world and no warnings. With that approach you can then exclude the failing run via exclude list. |
Code duplication is gone. Just one test file with two @run tags. |
|
To see where the JNI local refs warning comes from, I set a breakpoint in JavaThread::print_stack_on as that is called when the warning happens, although it doesn't print anything as there is no Java frame. Breakpoint 1, 0x00007ffff6efb8c0 in JavaThread::print_stack_on(outputStream*) () Specifically breaking in JNIHandles::make_local I see a lot of activity like: Breakpoint 2, 0x00007ffff6a240c4 in JNIHandles::make_local(oopDesc*) () LoadedClassesClosure::do_klass does indeed call make_local many times. If I do make classTrack_initialize state it wants a large number of local references, that warning disappears: |
|
This is the problematic code: It seems there are a few places where |
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 think we're getting there. A few further nits and now you also need to update the copyright year.
| * @summary Launching app with or without jdwp agent shouldn't produce any jni warnings. | ||
| * @modules jdk.compiler | ||
| * jdk.zipfs | ||
| * @compile TestXcheckJNIWarnings.java |
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 think the @compile directive is not necessary
| * @summary Launching app with or without jdwp agent shouldn't produce any jni warnings. | ||
| * @modules jdk.compiler | ||
| * jdk.zipfs | ||
| * @compile TestXcheckJNIWarnings.java |
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.
@compile can be removed.
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 great now 😄
|
Thank you all for your valuable feedback and for the reviews. Once the "still in progress" tests have completed successfully, I'll integrate. The failing linux-x86 tier1 test does not look related. It is a c2 compiler test. |
|
Sounds good. Comment above showing jvmti_GetLoadedClasses as the cause of the references was just to make sure we knew the cause of that other warning, but I see there is JDK-8296936 to follow up that issue. |
|
/integrate |
|
Going to push as commit eac26f4.
Your commit was automatically rebased without conflicts. |
This small change fixes a warning that may pop up during runtime. May I please request reviews? Thank you!
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11083/head:pull/11083$ git checkout pull/11083Update a local copy of the PR:
$ git checkout pull/11083$ git pull https://git.openjdk.org/jdk pull/11083/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 11083View PR using the GUI difftool:
$ git pr show -t 11083Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11083.diff