JDK-7144318 : GCLocker assert failure: assert(_needs_gc || SafepointSynchronize::is_at_safepoint(
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: hs23
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-02-09
  • Updated: 2013-09-18
  • Resolved: 2012-03-24
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
7u4Fixed 8Fixed hs23Fixed
There are nightly failures in the G1 GC baseline.

#  Internal Error (C:\temp\jprt\P1\063915.jcoomes\source\src\share\vm\memory/gcLocker.inline.hpp:31), pid=12028, tid=20836
#  assert(_needs_gc || SafepointSynchronize::is_at_safepoint()) failed: only read at safepoint

The assert started to show up after the hotspot-main -> hotspot-gc integration, which brought over the fix for:
7129164 - JNI Get/ReleasePrimitiveArrayCritical don't scale

EVALUATION http://hg.openjdk.java.net/lambda/lambda/hotspot/rev/ad3b47344802

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-gc/hotspot/rev/ad3b47344802

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/ad3b47344802

EVALUATION There's a minor race when clearing the _needs_gc flag. It transitions to true during a safepoint but the transition back is outside of a safepoint. needs_gc() && is_active() has two separate reads of _needs_gc and it can change in between. The logic should be changed so that they assert doesn't trigger in this case.