JDK-7014679 : G1: deadlock during concurrent cleanup
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: hs21
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-01-25
  • Updated: 2013-09-18
  • Resolved: 2011-04-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 6 JDK 7 Other
6u25Fixed 7Fixed hs20Fixed
Related Reports
Relates :  
Description
The fix for 7013718: G1: small fixes for two assert/guarantee failures seems to have introduced a deadlock in the code. The race is the following:

- GC threads want to allocate a new heap region, the free list is empty, and the "free regions coming" flag is set so they are waiting in case new regions are made available on the secondary free list.

- The concurrent cleanup thread has finished processing the cleanup list and is trying to join the STS to call the record_concurrent_mark_cleanup_completed() method:

        _cm->completeCleanup();
        _sts.join();
        g1_policy->record_concurrent_mark_cleanup_completed();
        _sts.leave();
        ...
        // We're done: no more free regions coming.
        g1h->reset_free_regions_coming();

We should actually call the reset_free_regions_coming() method, that notifies the GC workers that no more regions are coming, before trying to join the STS. That way the workers can complete their work so that the GC pause can also complete and allow the cleanup thread to join the STS.

Comments
EVALUATION http://hg.openjdk.java.net/hsx/hsx20/baseline/rev/908c5092d72a
09-02-2011

SUGGESTED FIX The concurrent cleanup thread should notify the GC threads that there are no more regions coming before it tries to join the STS.
25-01-2011

EVALUATION See Description.
25-01-2011