On Wed, 20 Jan 2021 14:34:15 GMT, Severin Gehwolf <sgehw...@openjdk.org> wrote:

>> This patch adds some explicit capacity for local refs. New regression test
>> fails prior and passes after the patch.
>> 
>> Thoughts?
>
> Severin Gehwolf has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains six additional 
> commits since the last revision:
> 
>  - Merge branch 'master' into JDK-8258836-check-jni-mbeanserver
>  - Actually assign the variable returned from PopLocalFrame
>  - Merge test files into one
>  - Adress review feedback from dholmes
>  - Merge branch 'master' into JDK-8258836-check-jni-mbeanserver
>  - 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo

There are serveral places where EXCEPTION_CHECK_AND_FREE is called while there 
is a pending PushLocalFrame (or 2). Corresponding PopLocalFrames are needed if 
there was an exception. The error handling has already proven somewhat tricky 
and error prone. This just makes it worse. I'm not sure if there is a good 
solution to this, or just continue adding PopLocalFrames in more places.

src/jdk.management/share/native/libmanagement_ext/DiagnosticCommandImpl.c line 
194:

> 192:                                                    
> dcmd_info_array[i].num_arguments);
> 193:       if (args == NULL) {
> 194:           (*env)->PopLocalFrame(env, NULL);

You actually need 2 PopLocalFrame calls here. One to match the PushLocalFrame 
inside this loop, and one to match the PushLocalFrame outside the loop.

src/jdk.management/share/native/libmanagement_ext/DiagnosticCommandImpl.c line 
218:

> 216:                                 args);
> 217:       if (obj == NULL) {
> 218:           (*env)->PopLocalFrame(env, NULL);

And 2 here also.

-------------

PR: https://git.openjdk.java.net/jdk/pull/2130

Reply via email to