RFR: 8314225: SIGSEGV in JavaThread::is_lock_owned [v2]

David Holmes dholmes at openjdk.org
Tue Jan 30 04:36:41 UTC 2024


On Fri, 26 Jan 2024 21:34:44 GMT, Kevin Walls <kevinw at openjdk.org> wrote:

>> JavaThread's _monitor_chunks member is temporary storage used by deoptimization.
>> When other threads inspect it using JavaThread::monitor_chunks(), if it is non-null that means a deoptimization is in progress, and the value will be removed shortly.
>> 
>> There are a few places where we attempt to follow the MonitorChunk*, but that would only be valid if deopt is in progress, and only safe if we could know the deopt is not going to complete.  But that the deopt will complete, and will free the MonitorChunks and clear the value.  So this is rare but there is a race and a risk of following a MonitorChunk* as it gets freed, and crashing.
>
> Kevin Walls has updated the pull request incrementally with one additional commit since the last revision:
> 
>   ThreadsListHandle required for Handshake

Okay so anything looking at monitor_chunks is looking at a moving target. They have no idea what stage of moving from compiled to interpreted frames has been reached. So examining monitor_chunks just seems inherently unsafe and totally misguided. On the other hand if you want to know about all monitors then you need to know whether this deopt is in progress or not, and prevent it from starting or wait for it to finish.

But I also don't see how we examine monitors that are still in compiled frames? `is_lock_owned` does not consider them.

??? This seems completely broken.

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

PR Comment: https://git.openjdk.org/jdk/pull/17566#issuecomment-1916058542


More information about the hotspot-dev mailing list