RFR: 8320515: assert(monitor->object_peek() != nullptr) failed: Owned monitors should not have a dead object

Stefan Karlsson stefank at openjdk.org
Thu Nov 23 11:52:38 UTC 2023


On Thu, 23 Nov 2023 00:48:19 GMT, David Holmes <dholmes at openjdk.org> wrote:

> > Previously, the locked monitors never got unlocked because the ObjectMonitor iterator never exposed these monitors to the JNI detach code
> 
> I had not realized that. It explains some confusion in a separate issue I had been looking into! It is important that these monitors are exposed and unlocked at detach time, otherwise it also messes up the `held_monitor_count`.
> 

I think I managed to reproduce that while reworking the tests and temporarily reintroducing the bug.

> > The thread dumping case doesn't tolerate ObjectMonitor with dead objects, so I'm filtering those in the closure
> 
> I think we may need to make that code tolerate the absence of an object.

IDK. That's another thing that would be good to discuss in a separate RFE.

> 
> > For GetOwnedMonitorInfo it is unclear if we should expose these weird ObjectMonitor.
> 
> I think we probably should expose this to be accurate, but I think this needs investigation on the JVMTI side to ensure that the null entry is tolerated okay. So a separate RFE to handle this would be fine.

This will lead to NPE in the management code, but it even if we fixed that, it could potentially causing NPEs in user code. So, yes, I wouldn't mind if someone wanted to investigate this as a separate RFE.

> 
> Thanks

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

PR Comment: https://git.openjdk.org/jdk/pull/16783#issuecomment-1824286615


More information about the build-dev mailing list