JDK-8004902 : correctness fixes motivated by contended locking work (6607129)
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: hs25
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-12-12
  • Updated: 2014-10-20
  • Resolved: 2013-01-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 Other
7u40Fixed 8Fixed hs24Fixed
Related Reports
Relates :  
Relates :  
Description
Work on contended locking via 6607129 has uncovered several correctness fixes:

1a) Add missing fence() to end of os::PlatformEvent::park() on both
    Linux and Solaris
1b) Add missing barrier to Parker::park() by using Atomic::xchg()
    to query _counter field (barrier is now on both code paths)
    on Linux only.
1c) Remove assert in java_lang_Thread::set_thread_status()
1d) Add missing fence() in ObjectMonitor::EnterI() (all platforms)
1e) Remove set of "_count = 0" in ObjectMonitor::set_owner() to
    avoid race with setting of _count during inflation.

Update: forgot to include the notes section:

Notes:
1c) The java_lang_Thread::set_thread_status() change is needed for
    the pending quick monitor operations. This means the change is
    potentially needed for several other buckets so I put it in the
    bug_fix bucket as a "common" place.

Comments
See attached cl_bug_fix_bucket-webrev-cr0.tgz, cl_bug_fix_bucket-webrev-cr1.tgz and cl_bug_fix_bucket-webrev-cr2.tgz for the webrevs from Code Review Round [012].
17-01-2013

During the internal code review for this fix, I wrote a detailed analysis of the original triangular race that was fixed by 6822370 and the reasons for the other fixes associated with this bug.
11-01-2013

1a and 1b - Will get discussed during the code review cycle. I'm sure Dave D. had his reasons for making these two changes. 1c - I forgot to include the notes section for why 1c was in this batch.
14-12-2012

1a) Add missing fence() to end of os::PlatformEvent::park() on both Linux and Solaris Why is a fence needed? The code is using pthread_mutex locking which provides its own memory ordering guarantees. 1b) Add missing barrier to Parker::park() by using Atomic::xchg() to query _counter field (barrier is now on both code paths) on Linux only. Again unclear where/why this is needed. 1c) Remove assert in java_lang_Thread::set_thread_status() Not that the assert seems critical but when do we set the thread status while not running _thread_in_vm?
12-12-2012