JDK-8057586 : Explicit GC ignored if GCLocker is active
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 9,17,20
  • Priority: P5
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-09-04
  • Updated: 2025-02-18
  • Resolved: 2023-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 21
21 b20Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
When a System.gc() is called, the VM operation is scheduled with no synchronization with the GCLocker and, in some cases, the Full GC immediately aborts if the GCLocker is active.

Even though the code path is different, the cause is similar to JDK-8057573.

I have reproduced this with both ParallelGC and CMS.
Comments
Changeset: 4a9f8efa Author: Ivan Walulya <iwalulya@openjdk.org> Date: 2023-04-24 08:47:23 +0000 URL: https://git.openjdk.org/jdk/commit/4a9f8efa867f84463f054d6624bcc5a89033e152
24-04-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/13191 Date: 2023-03-27 13:41:32 +0000
27-03-2023

ilw: impact: low -> causes young gc with non-full eden instead of full gc likelihood: medium -> lots of gc locker activity workaround: high -> fix application gc locker use -> P5
05-09-2014

This can be reproduced with the same test posted on JDK-8057573 (JNICriticalStressTest3). Run it this way: java -XX:+UseParallelOldGC -Xms3g -Xmx3g -Xmn2g -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -XX:+PrintHeapAtGC JNICriticalStressTest3 300 4 1 I attached example output from ParallelGC (output.ps.system-gc). System.gc() was called 59 times (look for the "SYSTEM_GC BEFORE / AFTER" output), but the log only shows 12 Full GCs. Here's the output from a Full GC that did not happen: SYSTEM_GC BEFORE SYSTEM_GC AFTER {Heap before GC invocations=89 (full 0): PSYoungGen total 2073088K, used 720665K [0x0000000740000000, 0x00000007c0000000, 0x00000007c0000000) eden space 2049024K, 34% used [0x0000000740000000,0x000000076ab2a0e8,0x00000007bd100000) from space 24064K, 87% used [0x00000007be880000,0x00000007bfd1c6e0,0x00000007c0000000) to space 24064K, 0% used [0x00000007bd100000,0x00000007bd100000,0x00000007be880000) ParOldGen total 1048576K, used 84032K [0x0000000700000000, 0x0000000740000000, 0x0000000740000000) object space 1048576K, 8% used [0x0000000700000000,0x0000000705210210,0x0000000740000000) Metaspace used 2783K, capacity 4496K, committed 4864K, reserved 1056768K class space used 293K, capacity 388K, committed 512K, reserved 1048576K 30.219: #88: [GC (GCLocker Initiated GC) [PSYoungGen: 720665K->7140K(2056192K)] 804698K->91437K(3104768K), 0.0049870 secs] [Times: user=0.01 sys=0.00 real=0.00 secs] Heap after GC invocations=89 (full 0): PSYoungGen total 2056192K, used 7140K [0x0000000740000000, 0x00000007c0000000, 0x00000007c0000000) eden space 2049024K, 0% used [0x0000000740000000,0x0000000740000000,0x00000007bd100000) from space 7168K, 99% used [0x00000007bd100000,0x00000007bd7f9230,0x00000007bd800000) to space 25600K, 0% used [0x00000007be700000,0x00000007be700000,0x00000007c0000000) ParOldGen total 1048576K, used 84296K [0x0000000700000000, 0x0000000740000000, 0x0000000740000000) object space 1048576K, 8% used [0x0000000700000000,0x0000000705252240,0x0000000740000000) Metaspace used 2783K, capacity 4496K, committed 4864K, reserved 1056768K class space used 293K, capacity 388K, committed 512K, reserved 1048576K } Note that instead of the Full GC, a GCLocker-initiated young GC happened with a non-full eden. This looks similar to JDK-8048556 but the cause is different. The Full GC checks whether the GCLocker is active with check_active_before_gc() which has the side-effect of telling the GCLocker to actually schedule a GC as it's normally called when the eden is full.
04-09-2014