On Mon, 20 May 2024 01:47:31 GMT, David Holmes <dhol...@openjdk.org> wrote:

> That smells fishy to me. A thread can always safely check if it owns 
> something because it can't race with itself and get a wrong answer.

Unfortunately checking ownership means comparing jobjects, which you can't 
safely do if you are comparing to a jobject that could be freed at any moment 
(I'm referring the JNI ref being freed, not the object being GC'd). I ran into 
asserts in JNI IsSameObject() due to this happening. Basically the local ref 
became invalid between the time it was fetched from the DebugRawMonitor and 
when is was used by IsSameObject().

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

PR Comment: https://git.openjdk.org/jdk/pull/19044#issuecomment-2119592870

Reply via email to