# HG changeset patch # User dholmes # Date 1259712624 18000 # Node ID 49bd3de668dc35ba7cff876422d114a91f35bbd2 # Parent b6e6e189e1db90e044c24be709bc581e2356a910 6822370: ReentrantReadWriteLock: threads hung when there are no threads holding onto the lock (Netra x4450) Summary: This day one bug is caused by missing memory barriers in various Parker::park() paths that can result in lost wakeups and hangs. Reviewed-by: dice, acorn diff -r b6e6e189e1db -r 49bd3de668dc src/os/linux/vm/os_linux.cpp --- a/src/os/linux/vm/os_linux.cpp Wed Nov 25 19:15:17 2009 -0800 +++ b/src/os/linux/vm/os_linux.cpp Tue Dec 01 19:10:24 2009 -0500 @@ -4656,6 +4656,7 @@ // Return immediately if a permit is available. if (_counter > 0) { _counter = 0 ; + OrderAccess::fence(); return ; } @@ -4698,6 +4699,7 @@ _counter = 0; status = pthread_mutex_unlock(_mutex); assert (status == 0, "invariant") ; + OrderAccess::fence(); return; } @@ -4737,7 +4739,7 @@ if (jt->handle_special_suspend_equivalent_condition()) { jt->java_suspend_self(); } - + OrderAccess::fence(); } void Parker::unpark() { diff -r b6e6e189e1db -r 49bd3de668dc src/os/solaris/vm/os_solaris.cpp --- a/src/os/solaris/vm/os_solaris.cpp Wed Nov 25 19:15:17 2009 -0800 +++ b/src/os/solaris/vm/os_solaris.cpp Tue Dec 01 19:10:24 2009 -0500 @@ -5803,6 +5803,7 @@ // Return immediately if a permit is available. if (_counter > 0) { _counter = 0 ; + OrderAccess::fence(); return ; } @@ -5846,6 +5847,7 @@ _counter = 0; status = os::Solaris::mutex_unlock(_mutex); assert (status == 0, "invariant") ; + OrderAccess::fence(); return; } @@ -5891,7 +5893,7 @@ if (jt->handle_special_suspend_equivalent_condition()) { jt->java_suspend_self(); } - + OrderAccess::fence(); } void Parker::unpark() {