RFR: 8314225: SIGSEGV in JavaThread::is_lock_owned

Dean Long dlong at openjdk.org
Wed May 1 08:43:53 UTC 2024


On Wed, 24 Apr 2024 19:50:08 GMT, Kevin Walls <kevinw at openjdk.org> wrote:

> Removal of JavaThread's MonitorChunks member.  This held lock information during deoptimization, but access to it is unnecessary for anything other than the deoptimization itself.
> 
> Access to it in is_lock_owned() was racy, and caused rare crashes.

src/hotspot/share/runtime/vframeArray.cpp line 100:

> 98: 
> 99:           assert(current_thread->is_Java_thread(), "Must be a JavaThread");
> 100:           assert(ObjectSynchronizer::current_thread_holds_lock((JavaThread*) current_thread, Handle(current_thread, dest->obj())),

This makes me wonder about the assert at line 96 that allows monitor->owner() == nullptr.  If that can happen due to OOM, then we need to check for that here too.

src/hotspot/share/runtime/vframeArray.cpp line 317:

> 315:     BasicObjectLock* src = _monitors->at(index);
> 316:     top->set_obj(src->obj());
> 317:     assert(ObjectSynchronizer::current_thread_holds_lock(thread, Handle(thread, src->obj())), "should be held, before move_to");

Same comment as above, may need to check for null obj.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18940#discussion_r1586025200
PR Review Comment: https://git.openjdk.org/jdk/pull/18940#discussion_r1586028694


More information about the hotspot-dev mailing list