RFR: 8327743: JVM crash in hotspot/share/runtime/javaThread.cpp - failed: held monitor count should be equal to jni: 0 != 1 [v5]
Richard Reingruber
rrich at openjdk.org
Thu Apr 11 08:33:43 UTC 2024
On Thu, 11 Apr 2024 01:15:26 GMT, David Holmes <dholmes at openjdk.org> wrote:
> In the general case the parent held count might be non-zero, but with vthreads and pinning it has to be zero.
With Patricios work in the loom repo we can reach here also when the vthread owns a Java monitor. I see that if the monitor was entered using JNI that this still prevents context switching (https://github.com/openjdk/loom/blob/09e4329fea5e3908855fa0881f156b7fa300a533/src/hotspot/share/runtime/continuationFreezeThaw.cpp#L1839-L1840). I somehow didn't expect this but after thinking about it twice I think it makes sense.
So reaching here with a non-zero JNI monitor count this means that the vthread is terminating. The following line could be improved to reflect this better if you want.
If the held monitor count is > 0 and this vthread is terminating then
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18445#discussion_r1560641317
More information about the hotspot-dev
mailing list