From sgehwolf at openjdk.java.net Mon Jan 18 14:18:01 2021 From: sgehwolf at openjdk.java.net (Severin Gehwolf) Date: Mon, 18 Jan 2021 14:18:01 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo Message-ID: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> This patch adds some explicit capacity for local refs. New regression test fails prior and passes after the patch. Thoughts? ------------- Commit messages: - 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo Changes: https://git.openjdk.java.net/jdk/pull/2130/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2130&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8258836 Stats: 127 lines in 3 files changed: 120 ins; 3 del; 4 mod Patch: https://git.openjdk.java.net/jdk/pull/2130.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/2130/head:pull/2130 PR: https://git.openjdk.java.net/jdk/pull/2130 From dholmes at openjdk.java.net Mon Jan 18 23:09:48 2021 From: dholmes at openjdk.java.net (David Holmes) Date: Mon, 18 Jan 2021 23:09:48 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo In-Reply-To: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> Message-ID: <3DbueRGZkbE8VhU1u0RY7oRsBLv4q39slRcU8s2oVJ4=.98232893-884f-4731-ba57-d76da5673fc3@github.com> On Mon, 18 Jan 2021 14:10:56 GMT, Severin Gehwolf wrote: > This patch adds some explicit capacity for local refs. New regression test > fails prior and passes after the patch. > > Thoughts? src/jdk.management/share/native/libmanagement_ext/DiagnosticCommandImpl.c line 189: > 187: cmd, > 188: dcmd_info_array[i].num_arguments); > 189: if (args == NULL) { Aren't you missing the PopLocalFrame for this return path? src/jdk.management/share/native/libmanagement_ext/DiagnosticCommandImpl.c line 214: > 212: if (obj == NULL) { > 213: free(dcmd_info_array); > 214: return NULL; Again aren't you missing the PopLocalFrame on this return path? ------------- PR: https://git.openjdk.java.net/jdk/pull/2130 From shade at openjdk.java.net Tue Jan 19 09:44:52 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Tue, 19 Jan 2021 09:44:52 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo In-Reply-To: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> Message-ID: On Mon, 18 Jan 2021 14:10:56 GMT, Severin Gehwolf wrote: > This patch adds some explicit capacity for local refs. New regression test > fails prior and passes after the patch. > > Thoughts? test/jdk/com/sun/management/DiagnosticCommandMBean/DcmdMBeanTestCheckJni.java line 38: > 36: public class DcmdMBeanTestCheckJni { > 37: > 38: public static void main(String[] args) throws Exception { I thought that handling the whole test in one file is the good style. See for example ` test/hotspot/jtreg/gc/stress/TestStressG1Uncommit.java`. ------------- PR: https://git.openjdk.java.net/jdk/pull/2130 From sgehwolf at openjdk.java.net Tue Jan 19 10:14:17 2021 From: sgehwolf at openjdk.java.net (Severin Gehwolf) Date: Tue, 19 Jan 2021 10:14:17 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo [v2] In-Reply-To: <3DbueRGZkbE8VhU1u0RY7oRsBLv4q39slRcU8s2oVJ4=.98232893-884f-4731-ba57-d76da5673fc3@github.com> References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> <3DbueRGZkbE8VhU1u0RY7oRsBLv4q39slRcU8s2oVJ4=.98232893-884f-4731-ba57-d76da5673fc3@github.com> Message-ID: On Mon, 18 Jan 2021 23:06:07 GMT, David Holmes wrote: >> 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 four additional commits since the last revision: >> >> - 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 > > src/jdk.management/share/native/libmanagement_ext/DiagnosticCommandImpl.c line 189: > >> 187: cmd, >> 188: dcmd_info_array[i].num_arguments); >> 189: if (args == NULL) { > > Aren't you missing the PopLocalFrame for this return path? Thanks, David. Added a call to `PopLocalFrame` here and in various other places where we have a short return. > src/jdk.management/share/native/libmanagement_ext/DiagnosticCommandImpl.c line 214: > >> 212: if (obj == NULL) { >> 213: free(dcmd_info_array); >> 214: return NULL; > > Again aren't you missing the PopLocalFrame on this return path? Fixed. ------------- PR: https://git.openjdk.java.net/jdk/pull/2130 From sgehwolf at openjdk.java.net Tue Jan 19 10:14:14 2021 From: sgehwolf at openjdk.java.net (Severin Gehwolf) Date: Tue, 19 Jan 2021 10:14:14 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo [v2] In-Reply-To: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> Message-ID: <7kVxVQBfU90U47YvNTWiplGZOkJLu89g69FITy4SElg=.2c361739-e61d-42d1-aa7f-20b01a0a7096@github.com> > 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 four additional commits since the last revision: - 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 ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/2130/files - new: https://git.openjdk.java.net/jdk/pull/2130/files/5b037556..3d94ec1b Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2130&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2130&range=00-01 Stats: 611 lines in 78 files changed: 265 ins; 151 del; 195 mod Patch: https://git.openjdk.java.net/jdk/pull/2130.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/2130/head:pull/2130 PR: https://git.openjdk.java.net/jdk/pull/2130 From sgehwolf at openjdk.java.net Tue Jan 19 10:14:19 2021 From: sgehwolf at openjdk.java.net (Severin Gehwolf) Date: Tue, 19 Jan 2021 10:14:19 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo [v2] In-Reply-To: References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> Message-ID: On Tue, 19 Jan 2021 09:41:27 GMT, Aleksey Shipilev wrote: >> 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 four additional commits since the last revision: >> >> - 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 > > test/jdk/com/sun/management/DiagnosticCommandMBean/DcmdMBeanTestCheckJni.java line 38: > >> 36: public class DcmdMBeanTestCheckJni { >> 37: >> 38: public static void main(String[] args) throws Exception { > > I thought that handling the whole test in one file is the good style. See for example ` > test/hotspot/jtreg/gc/stress/TestStressG1Uncommit.java`. OK. Updated the test. ------------- PR: https://git.openjdk.java.net/jdk/pull/2130 From sgehwolf at openjdk.java.net Tue Jan 19 10:14:15 2021 From: sgehwolf at openjdk.java.net (Severin Gehwolf) Date: Tue, 19 Jan 2021 10:14:15 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo In-Reply-To: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> Message-ID: On Mon, 18 Jan 2021 14:10:56 GMT, Severin Gehwolf wrote: > This patch adds some explicit capacity for local refs. New regression test > fails prior and passes after the patch. > > Thoughts? Thanks for the review! More thoughts? ------------- PR: https://git.openjdk.java.net/jdk/pull/2130 From cjplummer at openjdk.java.net Tue Jan 19 20:06:53 2021 From: cjplummer at openjdk.java.net (Chris Plummer) Date: Tue, 19 Jan 2021 20:06:53 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo [v2] In-Reply-To: <7kVxVQBfU90U47YvNTWiplGZOkJLu89g69FITy4SElg=.2c361739-e61d-42d1-aa7f-20b01a0a7096@github.com> References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> <7kVxVQBfU90U47YvNTWiplGZOkJLu89g69FITy4SElg=.2c361739-e61d-42d1-aa7f-20b01a0a7096@github.com> Message-ID: On Tue, 19 Jan 2021 10:14:14 GMT, Severin Gehwolf 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 four additional commits since the last revision: > > - 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 src/jdk.management/share/native/libmanagement_ext/DiagnosticCommandImpl.c line 113: > 111: return NULL; > 112: } > 113: (*env)->PopLocalFrame(env, obj); This needs to assign the result to `obj` in order to get the affect you are looking for. Otherwise it is really no different than passing in `NULL.`, and in the `SetObjectArrayElement` that follows you'll end up assigning a popped localref. I'm surprised this didn't result in some sort of test failure. Are you testing with `num_args > 1`? Perhaps the localref frames are not eagerly reused. src/jdk.management/share/native/libmanagement_ext/DiagnosticCommandImpl.c line 172: > 170: } > 171: if (num_commands == 0) { > 172: (*env)->PopLocalFrame(env, result); Also here you need to assign the result to `result`. src/jdk.management/share/native/libmanagement_ext/DiagnosticCommandImpl.c line 222: > 220: return NULL; > 221: } > 222: (*env)->PopLocalFrame(env, obj); ...and assign to `obj` here. src/jdk.management/share/native/libmanagement_ext/DiagnosticCommandImpl.c line 227: > 225: EXCEPTION_CHECK_AND_FREE(dcmd_info_array); > 226: } > 227: (*env)->PopLocalFrame(env, result); ...and assign to `result` here. ------------- PR: https://git.openjdk.java.net/jdk/pull/2130 From sgehwolf at openjdk.java.net Wed Jan 20 14:21:15 2021 From: sgehwolf at openjdk.java.net (Severin Gehwolf) Date: Wed, 20 Jan 2021 14:21:15 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo [v3] In-Reply-To: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> Message-ID: > 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 incrementally with one additional commit since the last revision: Actually assign the variable returned from PopLocalFrame ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/2130/files - new: https://git.openjdk.java.net/jdk/pull/2130/files/3d94ec1b..66b4c6c0 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2130&range=02 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2130&range=01-02 Stats: 4 lines in 1 file changed: 0 ins; 0 del; 4 mod Patch: https://git.openjdk.java.net/jdk/pull/2130.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/2130/head:pull/2130 PR: https://git.openjdk.java.net/jdk/pull/2130 From sgehwolf at openjdk.java.net Wed Jan 20 14:34:15 2021 From: sgehwolf at openjdk.java.net (Severin Gehwolf) Date: Wed, 20 Jan 2021 14:34:15 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo [v4] In-Reply-To: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> Message-ID: > 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 ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/2130/files - new: https://git.openjdk.java.net/jdk/pull/2130/files/66b4c6c0..1a7365f3 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2130&range=03 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2130&range=02-03 Stats: 3344 lines in 53 files changed: 452 ins; 2757 del; 135 mod Patch: https://git.openjdk.java.net/jdk/pull/2130.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/2130/head:pull/2130 PR: https://git.openjdk.java.net/jdk/pull/2130 From sgehwolf at openjdk.java.net Wed Jan 20 14:34:19 2021 From: sgehwolf at openjdk.java.net (Severin Gehwolf) Date: Wed, 20 Jan 2021 14:34:19 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo [v2] In-Reply-To: References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> <7kVxVQBfU90U47YvNTWiplGZOkJLu89g69FITy4SElg=.2c361739-e61d-42d1-aa7f-20b01a0a7096@github.com> Message-ID: On Tue, 19 Jan 2021 19:55:22 GMT, Chris Plummer wrote: >> 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 four additional commits since the last revision: >> >> - 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 > > src/jdk.management/share/native/libmanagement_ext/DiagnosticCommandImpl.c line 113: > >> 111: return NULL; >> 112: } >> 113: (*env)->PopLocalFrame(env, obj); > > This needs to assign the result to `obj` in order to get the affect you are looking for. Otherwise it is really no different than passing in `NULL.`, and in the `SetObjectArrayElement` that follows you'll end up assigning a popped localref. I'm surprised this didn't result in some sort of test failure. Are you testing with `num_args > 1`? Perhaps the localref frames are not eagerly reused. Doh! Thanks Chris! Fixed. It did result in test failures (for fastdebug build). For example https://github.com/jerboaa/jdk/runs/1727117374?check_suite_focus=true Sorry for missing this. > src/jdk.management/share/native/libmanagement_ext/DiagnosticCommandImpl.c line 172: > >> 170: } >> 171: if (num_commands == 0) { >> 172: (*env)->PopLocalFrame(env, result); > > Also here you need to assign the result to `result`. Fixed. > src/jdk.management/share/native/libmanagement_ext/DiagnosticCommandImpl.c line 222: > >> 220: return NULL; >> 221: } >> 222: (*env)->PopLocalFrame(env, obj); > > ...and assign to `obj` here. Fixed. > src/jdk.management/share/native/libmanagement_ext/DiagnosticCommandImpl.c line 227: > >> 225: EXCEPTION_CHECK_AND_FREE(dcmd_info_array); >> 226: } >> 227: (*env)->PopLocalFrame(env, result); > > ...and assign to `result` here. Fixed now. ------------- PR: https://git.openjdk.java.net/jdk/pull/2130 From cjplummer at openjdk.java.net Wed Jan 20 21:29:56 2021 From: cjplummer at openjdk.java.net (Chris Plummer) Date: Wed, 20 Jan 2021 21:29:56 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo [v4] In-Reply-To: References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> Message-ID: On Wed, 20 Jan 2021 14:34:15 GMT, Severin Gehwolf 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 From cjplummer at openjdk.java.net Wed Jan 20 21:38:48 2021 From: cjplummer at openjdk.java.net (Chris Plummer) Date: Wed, 20 Jan 2021 21:38:48 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo [v4] In-Reply-To: References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> Message-ID: On Wed, 20 Jan 2021 21:27:08 GMT, Chris Plummer wrote: >> 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. I wonder if you actually have to call PopLocalFrame before returning. I couldn't find anything in the spec that indicates you need too. But there's no indication that you don't either. ------------- PR: https://git.openjdk.java.net/jdk/pull/2130 From shade at openjdk.java.net Thu Jan 21 09:08:58 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Thu, 21 Jan 2021 09:08:58 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo [v4] In-Reply-To: References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> Message-ID: On Wed, 20 Jan 2021 14:34:15 GMT, Severin Gehwolf 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 The test looks good. You might want to say `/reviewers 2` to keep bots from assuming this approval is enough. test/jdk/com/sun/management/DiagnosticCommandMBean/DcmdMBeanTestCheckJni.java line 60: > 58: class DcmdMBeanRunner { > 59: > 60: private static String HOTSPOT_DIAGNOSTIC_MXBEAN_NAME = Excess newline and the filed could be `static final`. Actually, you might even go and merge both classes, and then pass a fake java arg in `main` to disambiguate the "driver" and "test" code, like: public static void main(String[] args) { if (args.length == 0) { driver(); } else { runner(); } } Your call. ------------- Marked as reviewed by shade (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/2130 From sgehwolf at openjdk.java.net Thu Jan 21 15:42:14 2021 From: sgehwolf at openjdk.java.net (Severin Gehwolf) Date: Thu, 21 Jan 2021 15:42:14 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo [v5] In-Reply-To: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> Message-ID: <5bpHb5T-eMZL-70Dhr1Svi1QH9edGfNE-IfDtEXkcbQ=.ad1241b3-5411-4d05-9e4f-fa160c7b5dec@github.com> > 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 incrementally with two additional commits since the last revision: - Improve popping of local frames in the error case - Make HOTSPOT_DIAGNOSTIC_MXBEAN_NAME final ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/2130/files - new: https://git.openjdk.java.net/jdk/pull/2130/files/1a7365f3..b7c81653 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2130&range=04 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2130&range=03-04 Stats: 28 lines in 2 files changed: 11 ins; 0 del; 17 mod Patch: https://git.openjdk.java.net/jdk/pull/2130.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/2130/head:pull/2130 PR: https://git.openjdk.java.net/jdk/pull/2130 From sgehwolf at openjdk.java.net Thu Jan 21 15:42:20 2021 From: sgehwolf at openjdk.java.net (Severin Gehwolf) Date: Thu, 21 Jan 2021 15:42:20 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo [v4] In-Reply-To: References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> Message-ID: On Thu, 21 Jan 2021 09:06:00 GMT, Aleksey Shipilev wrote: >> 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 > > The test looks good. You might want to say `/reviewers 2` to keep bots from assuming this approval is enough. > I wonder if you actually have to call PopLocalFrame before returning. I couldn't find anything in the spec that indicates you need too. But there's no indication that you don't either. @plummercj OK, I did go over the code once more and changed the `EXCEPTION_CHECK_AND_FREE` macro slightly so that it now also handles popping of local frames. If the popping isn't needed, so be it, but I guess this is now a more correct version. Leaves pushing/popping of local frames consistent no matter if we short-return or not. Do you think that's OK now? > test/jdk/com/sun/management/DiagnosticCommandMBean/DcmdMBeanTestCheckJni.java line 60: > >> 58: class DcmdMBeanRunner { >> 59: >> 60: private static String HOTSPOT_DIAGNOSTIC_MXBEAN_NAME = > > Excess newline and the filed could be `static final`. Actually, you might even go and merge both classes, and then pass a fake java arg in `main` to disambiguate the "driver" and "test" code, like: > > public static void main(String[] args) { > if (args.length == 0) { > driver(); > } else { > runner(); > } > } > > Your call. Thanks. I've made `HOTSPOT_DIAGNOSTIC_MXBEAN_NAME` final too. The line break is so that the line doesn't exceed 80 chars. Not sure if that's still something to consider, but it shouldn't really do any harm, so I've left it. I'm on the fence about `DcmdMBeanRunner` class. Seems a tad easier to read to me as is rather than the conditional code. Hope that's OK. ------------- PR: https://git.openjdk.java.net/jdk/pull/2130 From sgehwolf at openjdk.java.net Thu Jan 21 15:42:28 2021 From: sgehwolf at openjdk.java.net (Severin Gehwolf) Date: Thu, 21 Jan 2021 15:42:28 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo [v4] In-Reply-To: References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> Message-ID: On Wed, 20 Jan 2021 21:20:43 GMT, Chris Plummer wrote: >> 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 > > 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. Fixed. > 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. Fixed. ------------- PR: https://git.openjdk.java.net/jdk/pull/2130 From cjplummer at openjdk.java.net Thu Jan 21 20:49:14 2021 From: cjplummer at openjdk.java.net (Chris Plummer) Date: Thu, 21 Jan 2021 20:49:14 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo [v5] In-Reply-To: <5bpHb5T-eMZL-70Dhr1Svi1QH9edGfNE-IfDtEXkcbQ=.ad1241b3-5411-4d05-9e4f-fa160c7b5dec@github.com> References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> <5bpHb5T-eMZL-70Dhr1Svi1QH9edGfNE-IfDtEXkcbQ=.ad1241b3-5411-4d05-9e4f-fa160c7b5dec@github.com> Message-ID: <0NK8_XKl74zgPc4nUeX2U3WZ4mHWWmTcQKCLRDmNbH0=.02c513c0-4d2f-4369-8eea-0e72555afe5a@github.com> On Thu, 21 Jan 2021 15:42:14 GMT, Severin Gehwolf 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 incrementally with two additional commits since the last revision: > > - Improve popping of local frames in the error case > - Make HOTSPOT_DIAGNOSTIC_MXBEAN_NAME final Getting close: - Line 188 where there is a JNU_ThrowOutOfMemoryError needs a PopLocalFrame before it. - Copyrights need updating ------------- PR: https://git.openjdk.java.net/jdk/pull/2130 From sgehwolf at openjdk.java.net Fri Jan 22 09:37:46 2021 From: sgehwolf at openjdk.java.net (Severin Gehwolf) Date: Fri, 22 Jan 2021 09:37:46 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo [v5] In-Reply-To: <0NK8_XKl74zgPc4nUeX2U3WZ4mHWWmTcQKCLRDmNbH0=.02c513c0-4d2f-4369-8eea-0e72555afe5a@github.com> References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> <5bpHb5T-eMZL-70Dhr1Svi1QH9edGfNE-IfDtEXkcbQ=.ad1241b3-5411-4d05-9e4f-fa160c7b5dec@github.com> <0NK8_XKl74zgPc4nUeX2U3WZ4mHWWmTcQKCLRDmNbH0=.02c513c0-4d2f-4369-8eea-0e72555afe5a@github.com> Message-ID: On Thu, 21 Jan 2021 20:46:12 GMT, Chris Plummer wrote: > Getting close: > > * Line 188 where there is a JNU_ThrowOutOfMemoryError needs a PopLocalFrame before it. > * Copyrights need updating Should be fixed now. Thoughts? ------------- PR: https://git.openjdk.java.net/jdk/pull/2130 From sgehwolf at openjdk.java.net Fri Jan 22 09:37:45 2021 From: sgehwolf at openjdk.java.net (Severin Gehwolf) Date: Fri, 22 Jan 2021 09:37:45 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo [v6] In-Reply-To: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> Message-ID: > 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 10 additional commits since the last revision: - Merge branch 'master' into JDK-8258836-check-jni-mbeanserver - Fix copyright and one more PopLocalFrame - Improve popping of local frames in the error case - Make HOTSPOT_DIAGNOSTIC_MXBEAN_NAME final - 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 ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/2130/files - new: https://git.openjdk.java.net/jdk/pull/2130/files/b7c81653..8d0d6e98 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2130&range=05 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2130&range=04-05 Stats: 6260 lines in 194 files changed: 2672 ins; 2194 del; 1394 mod Patch: https://git.openjdk.java.net/jdk/pull/2130.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/2130/head:pull/2130 PR: https://git.openjdk.java.net/jdk/pull/2130 From sgehwolf at openjdk.java.net Fri Jan 22 20:00:55 2021 From: sgehwolf at openjdk.java.net (Severin Gehwolf) Date: Fri, 22 Jan 2021 20:00:55 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo [v5] In-Reply-To: <0NK8_XKl74zgPc4nUeX2U3WZ4mHWWmTcQKCLRDmNbH0=.02c513c0-4d2f-4369-8eea-0e72555afe5a@github.com> References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> <5bpHb5T-eMZL-70Dhr1Svi1QH9edGfNE-IfDtEXkcbQ=.ad1241b3-5411-4d05-9e4f-fa160c7b5dec@github.com> <0NK8_XKl74zgPc4nUeX2U3WZ4mHWWmTcQKCLRDmNbH0=.02c513c0-4d2f-4369-8eea-0e72555afe5a@github.com> Message-ID: <6Y-vbUzletGYWSW8F7ibpcGT8yidHfBft9yFKmrzWEg=.e17b6306-7e84-4aba-bf8d-aeec4ea74cea@github.com> On Thu, 21 Jan 2021 20:46:12 GMT, Chris Plummer wrote: >> Severin Gehwolf has updated the pull request incrementally with two additional commits since the last revision: >> >> - Improve popping of local frames in the error case >> - Make HOTSPOT_DIAGNOSTIC_MXBEAN_NAME final > > Getting close: > - Line 188 where there is a JNU_ThrowOutOfMemoryError needs a PopLocalFrame before it. > - Copyrights need updating @plummercj Could you look at the latest version of this please? Much appreciated. ------------- PR: https://git.openjdk.java.net/jdk/pull/2130 From cjplummer at openjdk.java.net Fri Jan 22 20:21:48 2021 From: cjplummer at openjdk.java.net (Chris Plummer) Date: Fri, 22 Jan 2021 20:21:48 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo [v6] In-Reply-To: References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> Message-ID: On Fri, 22 Jan 2021 09:37:45 GMT, Severin Gehwolf 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 10 additional commits since the last revision: > > - Merge branch 'master' into JDK-8258836-check-jni-mbeanserver > - Fix copyright and one more PopLocalFrame > - Improve popping of local frames in the error case > - Make HOTSPOT_DIAGNOSTIC_MXBEAN_NAME final > - 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 Looks good. ------------- Marked as reviewed by cjplummer (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/2130 From sgehwolf at openjdk.java.net Mon Jan 25 09:02:48 2021 From: sgehwolf at openjdk.java.net (Severin Gehwolf) Date: Mon, 25 Jan 2021 09:02:48 GMT Subject: jmx-dev Integrated: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo In-Reply-To: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> Message-ID: On Mon, 18 Jan 2021 14:10:56 GMT, Severin Gehwolf wrote: > This patch adds some explicit capacity for local refs. New regression test > fails prior and passes after the patch. > > Thoughts? This pull request has now been integrated. Changeset: af155fc0 Author: Severin Gehwolf URL: https://git.openjdk.java.net/jdk/commit/af155fc0 Stats: 140 lines in 2 files changed: 117 ins; 3 del; 20 mod 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo Reviewed-by: cjplummer, shade ------------- PR: https://git.openjdk.java.net/jdk/pull/2130 From sgehwolf at openjdk.java.net Mon Jan 25 09:02:45 2021 From: sgehwolf at openjdk.java.net (Severin Gehwolf) Date: Mon, 25 Jan 2021 09:02:45 GMT Subject: jmx-dev RFR: 8258836: JNI local refs exceed capacity getDiagnosticCommandInfo [v6] In-Reply-To: References: <-TnAHSlqqMRorow1OazpszlalrhNFAoV-uMTvmjAR5o=.459664d4-bf85-41b8-963d-b4c69f2bb19f@github.com> Message-ID: On Fri, 22 Jan 2021 20:18:39 GMT, Chris Plummer wrote: >> 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 10 additional commits since the last revision: >> >> - Merge branch 'master' into JDK-8258836-check-jni-mbeanserver >> - Fix copyright and one more PopLocalFrame >> - Improve popping of local frames in the error case >> - Make HOTSPOT_DIAGNOSTIC_MXBEAN_NAME final >> - 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 > > Looks good. Thanks for the review! ------------- PR: https://git.openjdk.java.net/jdk/pull/2130