RFR: 8280743: HSDB "Monitor Cache Dump" command might throw NPE

Kevin Walls kevinw at openjdk.org
Mon Aug 21 20:44:34 UTC 2023


On Mon, 21 Aug 2023 19:54:59 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

> ObjectMonitor.object() can be null so we need to defend against it. This bug was discovered by code inspection while working on [JDK-8280555](https://bugs.openjdk.org/browse/JDK-8280555).  We have no test for this, and I'm not sure how to reproduce this with HSDB like the [JDK-8280555](https://bugs.openjdk.org/browse/JDK-8280555) test did.  I did at least verify that the HSDB "Monitor Cache Dump" feature still works after this fix, although none of the monitors had a null object.

I see ObjectHeap accepts and handles a null, returning null, so the newOop() call is OK to pass a null, though it could be moved to inside the else.  
Maybe you're saying it's best that the Heap decides if null handle means null oop. 8-)

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

Marked as reviewed by kevinw (Committer).

PR Review: https://git.openjdk.org/jdk/pull/15369#pullrequestreview-1587843322


More information about the serviceability-dev mailing list