On Fri, 30 Oct 2026 02:38:50 GMT, Koichi Sakata <[email protected]> wrote:
>> This change prevents NullPointerException in the clhsdb dumpcodecache >> command. >> >> `CodeCache.createCodeBlobWrapper()` causes NullPointerException. >> `CodeHeap.findStart()` may return null and `CodeHeap.iterate()` passes it to >> `CodeCache.createCodeBlobWrapper()` as the `cbStart` argument. >> >> https://github.com/openjdk/jdk/blob/bbd629b0ef4d0ac7fbc2b33bb76170fd15060cd3/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/CodeHeap.java#L111 >> >> So this change makes `createCodeBlobWrapper()` return null when `cbStart` is >> null. >> >> ### Testing >> * jtreg:hotspot/jtreg/serviceability/sa/ >> >> $ make test TEST="jtreg:hotspot/jtreg/serviceability/sa/" >> ============================== >> TEST TOTAL PASS FAIL ERROR >> SKIP >> jtreg:test/hotspot/jtreg/serviceability/sa 81 76 0 0 >> 5 >> ============================== >> >> * Manual verification: dumpcodecache does not output NullPointerException. >> >> $ jhsdb clhsdb --pid 654607 >> Attaching to process 654607, please wait... >> hsdb> dumpcodecache >> <snip> >> hsdb> >> >> Note: `hotspot/jtreg/serviceability/sa/TestDebugInfoDecode.java` passed, but >> printed NullPointerException before this change. There is no >> NullPointerException in the test output after the change. >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Koichi Sakata has updated the pull request incrementally with one additional > commit since the last revision: > > Check whether NullPointerException is printed in TestDebugInfoDecode `TestDebugInfoDecode` checks for "java.lang.NullPointerException" in the output. At first, it checked just for "Exception", but the test failed a few times out of 300 for each OS due to the following exception in the output: Exception while decoding debug info for NMethod for jdk/internal/classfile/impl/StackMapGenerator$Type.<clinit>()V==>nsun.jvm.hotspot.code.NMethod@0x0000ffff8bfda748 sun.jvm.hotspot.utilities.AssertionFailure: inconsistent debug information at jdk.hotspot.agent/sun.jvm.hotspot.utilities.Assert.that(Assert.java:32) at jdk.hotspot.agent/sun.jvm.hotspot.code.ScopeDesc.decodeObjectValues(ScopeDesc.java:210) at jdk.hotspot.agent/sun.jvm.hotspot.code.ScopeDesc.<init>(ScopeDesc.java:75) at jdk.hotspot.agent/sun.jvm.hotspot.code.NMethod.decodeAllScopeDescs(NMethod.java:304) at TestDebugInfoDecode$1.visit(TestDebugInfoDecode.java:73) at jdk.hotspot.agent/sun.jvm.hotspot.memory.CodeHeap.iterate(CodeHeap.java:113) at jdk.hotspot.agent/sun.jvm.hotspot.code.CodeCache.iterate(CodeCache.java:135) at TestDebugInfoDecode.checkDecode(TestDebugInfoDecode.java:84) at TestDebugInfoDecode.main(TestDebugInfoDecode.java:119) Both jtreg SA tests and the manual clhsdb test pass after the new fix. ------------- PR Comment: https://git.openjdk.org/jdk/pull/33568#issuecomment-6514310709
