JDK-8230292 : Handshakes can live-lock causing a stack overflow.
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 13,14
  • Priority: P2
  • Status: Resolved
  • Resolution: Not an Issue
  • Submitted: 2019-08-28
  • Updated: 2019-08-30
  • Resolved: 2019-08-30
Related Reports
Relates :  
Description
#37681 0x00007f353cd6af4b in JavaThread::handshake_process_by_self (this=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/thread.hpp:1327
#37682 SafepointMechanism::block_or_handshake (thread=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/safepointMechanism.cpp:94
#37683 SafepointMechanism::block_or_handshake (thread=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/safepointMechanism.cpp:86
#37684 SafepointMechanism::block_if_requested_slow (thread=thread@entry=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/safepointMechanism.cpp:103
#37685 0x00007f353c459137 in SafepointMechanism::block_if_requested (thread=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/safepointMechanism.inline.hpp:62
#37686 ThreadStateTransition::transition (to=_thread_blocked, from=_thread_in_vm, thread=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/interfaceSupport.inline.hpp:98
#37687 ThreadStateTransition::trans (this=0x7f34f9239420, to=_thread_blocked, from=_thread_in_vm) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/interfaceSupport.inline.hpp:126
#37688 ThreadBlockInVM::ThreadBlockInVM (thread=0x7f34a8266000, this=0x7f34f9239420) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/interfaceSupport.inline.hpp:247
#37689 Semaphore::wait_with_safepoint_check (thread=0x7f34a8266000, this=0x7f34a8266488) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/semaphore.inline.hpp:34
#37690 HandshakeState::process_by_self (this=this@entry=0x7f34a8266480, thread=thread@entry=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/handshake.cpp:297
#37691 0x00007f353cd6af4b in JavaThread::handshake_process_by_self (this=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/thread.hpp:1327
#37692 SafepointMechanism::block_or_handshake (thread=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/safepointMechanism.cpp:94
#37693 SafepointMechanism::block_or_handshake (thread=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/safepointMechanism.cpp:86
#37694 SafepointMechanism::block_if_requested_slow (thread=thread@entry=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/safepointMechanism.cpp:103
#37695 0x00007f353c459137 in SafepointMechanism::block_if_requested (thread=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/safepointMechanism.inline.hpp:62
#37696 ThreadStateTransition::transition (to=_thread_blocked, from=_thread_in_vm, thread=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/interfaceSupport.inline.hpp:98
#37697 ThreadStateTransition::trans (this=0x7f34f9239530, to=_thread_blocked, from=_thread_in_vm) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/interfaceSupport.inline.hpp:126
#37698 ThreadBlockInVM::ThreadBlockInVM (thread=0x7f34a8266000, this=0x7f34f9239530) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/interfaceSupport.inline.hpp:247
#37699 Semaphore::wait_with_safepoint_check (thread=0x7f34a8266000, this=0x7f34a8266488) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/semaphore.inline.hpp:34
#37700 HandshakeState::process_by_self (this=this@entry=0x7f34a8266480, thread=thread@entry=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/handshake.cpp:297
#37701 0x00007f353cd6af4b in JavaThread::handshake_process_by_self (this=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/thread.hpp:1327
#37702 SafepointMechanism::block_or_handshake (thread=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/safepointMechanism.cpp:94
#37703 SafepointMechanism::block_or_handshake (thread=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/safepointMechanism.cpp:86
#37704 SafepointMechanism::block_if_requested_slow (thread=thread@entry=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/safepointMechanism.cpp:103
#37705 0x00007f353c459137 in SafepointMechanism::block_if_requested (thread=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/safepointMechanism.inline.hpp:62
#37706 ThreadStateTransition::transition (to=_thread_blocked, from=_thread_in_vm, thread=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/interfaceSupport.inline.hpp:98
#37707 ThreadStateTransition::trans (this=0x7f34f9239640, to=_thread_blocked, from=_thread_in_vm) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/interfaceSupport.inline.hpp:126
#37708 ThreadBlockInVM::ThreadBlockInVM (thread=0x7f34a8266000, this=0x7f34f9239640) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/interfaceSupport.inline.hpp:247
#37709 Semaphore::wait_with_safepoint_check (thread=0x7f34a8266000, this=0x7f34a8266488) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/semaphore.inline.hpp:34
#37710 HandshakeState::process_by_self (this=this@entry=0x7f34a8266480, thread=thread@entry=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/handshake.cpp:297
#37711 0x00007f353cd6af4b in JavaThread::handshake_process_by_self (this=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/thread.hpp:1327
#37712 SafepointMechanism::block_or_handshake (thread=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/safepointMechanism.cpp:94
#37713 SafepointMechanism::block_or_handshake (thread=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/safepointMechanism.cpp:86
#37714 SafepointMechanism::block_if_requested_slow (thread=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/safepointMechanism.cpp:103
#37715 0x00007f353cb56b10 in SafepointMechanism::block_if_requested (thread=<optimized out>) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/safepointMechanism.inline.hpp:62
#37716 ThreadBlockInVMWithDeadlockCheck::~ThreadBlockInVMWithDeadlockCheck (this=0x7f34f9239710, __in_chrg=<optimized out>) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/interfaceSupport.inline
.hpp:297
#37717 Monitor::wait (this=0x7f353401f1c0, timeout=timeout@entry=0, as_suspend_equivalent=as_suspend_equivalent@entry=false) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/mutex.cpp:200
#37718 0x00007f353d12a0f6 in MonitorLocker::wait (timeout=0, as_suspend_equivalent=false, this=0x7f34f9239770) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/mutexLocker.hpp:248
#37719 VMThread::execute (op=op@entry=0x7f34f9239930) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/vmThread.cpp:711
#37720 0x00007f353c458cc8 in Handshake::execute (thread_cl=thread_cl@entry=0x7f34f9239a30, target=target@entry=0x7f34a820f000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/handshake.cpp:268
#37721 0x00007f353bd65329 in BiasedLocking::single_revoke_with_handshake (obj=..., requester=requester@entry=0x7f34a8266000, biaser=biaser@entry=0x7f34a820f000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/
share/runtime/biasedLocking.cpp:626
#37722 0x00007f353bd678cb in BiasedLocking::revoke (obj=..., __the_thread__=__the_thread__@entry=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/biasedLocking.cpp:833
#37723 0x00007f353cfbd8b7 in ObjectSynchronizer::enter (obj=obj@entry=..., lock=lock@entry=0x7f34f923a2c8, __the_thread__=__the_thread__@entry=0x7f34a8266000) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/sh
are/runtime/synchronizer.cpp:268
#37724 0x00007f353bedae75 in Runtime1::monitorenter (thread=0x7f34a8266000, obj=0x629b80c18, lock=0x7f34f923a2c8) at /home/rehn/source/jdk/dev-jdk/open/src/hotspot/share/runtime/basicLock.hpp:73
#37725 0x00007f351c7ae0d4 in ?? ()

Comments
Biased locking is contributing to this, but not the main cause. I had a small change which made this possible. It not should be an issue in mainline. (i can't reproduce on a clean jdk/jdk nor does it seem possible reading the 'clean' code)
30-08-2019

I would also say that it was the use of handshakes for biased-locking revocation that also made this possible - no?
28-08-2019

I wouldn't call it a livelock, it's reentrant use of the thread transition code that leads to infinite recursion.
28-08-2019

It looks like the introduction of ThreadBlockInVMWithDeadlockCheck made this livelock possible, which came from 8210832: Remove sneaky locking in class Monitor.
28-08-2019

IWL=HLH => P2
28-08-2019