-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
8139424: SIGSEGV, Problematic frame: # V [libjvm.so+0xd0c0cc] void In…
…stanceKlass::oop_oop_iterate_oop_maps_specialized<true,oopDesc*,MarkAndPushClosure> The crash was caused by a faulty eager humongous reclaim. The reason for reclaiming a live object was that the call to cleanupHRRS was done after dirtying cards and clearing the remembered sets for the humongous object. This could lead to one or many cards being missed. Reviewed-by: tbenson, kbarrett, tschatzl
- Loading branch information
David Buck
committed
Jan 19, 2016
1 parent
63a581a
commit baf5076
Showing
3 changed files
with
101 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
hotspot/test/gc_implementation/g1/TestNoEagerReclaimOfHumongousRegions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
/* | ||
* @test TestNoEagerReclaimOfHumongousRegions | ||
* @bug 8139424 | ||
* @summary Test to check that a live humongous object is not eagerly reclaimed. This is a regression test for | ||
* 8139424 and the test will crash if an eager reclaim occur. The test is not 100% deterministic and | ||
* might pass even if there are problems in the code, but it will never crash unless there is a problem. | ||
* @requires vm.gc=="G1" | vm.gc=="null" | ||
* @key gc | ||
* @library /testlibrary /testlibrary/whitebox | ||
* @modules java.base/sun.misc | ||
* @build TestNoEagerReclaimOfHumongousRegions | ||
* @run main ClassFileInstaller sun.hotspot.WhiteBox | ||
* sun.hotspot.WhiteBox$WhiteBoxPermission | ||
* @run main/othervm -Xbootclasspath/a:. -XX:+PrintGC -XX:+UseG1GC -XX:MaxTenuringThreshold=0 -XX:G1RSetSparseRegionEntries=32 -XX:G1HeapRegionSize=1m -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+G1TraceEagerReclaimHumongousObjects TestNoEagerReclaimOfHumongousRegions | ||
*/ | ||
|
||
import java.util.LinkedList; | ||
|
||
import sun.hotspot.WhiteBox; | ||
|
||
public class TestNoEagerReclaimOfHumongousRegions { | ||
// Helper class to keep reference to humongous byte[]. | ||
static class LargeRef { | ||
private byte[] _ref; | ||
|
||
LargeRef(byte[] ref) { | ||
_ref = ref; | ||
} | ||
|
||
byte[] ref() { return _ref; } | ||
} | ||
|
||
static LargeRef humongous_reference_holder; | ||
|
||
public static void main(String[] args) throws InterruptedException{ | ||
WhiteBox wb = WhiteBox.getWhiteBox(); | ||
LinkedList<Object> garbageAndRefList = new LinkedList<Object>(); | ||
// Creating a 1M large byte array. Since the test specifies the heap | ||
// region size to be 1m this will be a humongous object. We then | ||
// store a pointer to the array in the static object to keep it live | ||
// during the whole test. | ||
humongous_reference_holder = new LargeRef(new byte[1 * 1024 * 1024]); | ||
|
||
// Create some garbage and a reference to the humongous object each round. | ||
for (int i = 0; i < 32; i++) { | ||
garbageAndRefList.add(new byte[400*1000]); | ||
garbageAndRefList.add(new LargeRef(humongous_reference_holder.ref())); | ||
|
||
// Promote to old, goal is to get rem-set entries for the humongous | ||
// object from different regions. The test specifies MaxTenuringThreshold=0, | ||
// this will make sure we get objects promoted to old at once. | ||
wb.youngGC(); | ||
} | ||
// Clear the garbage and reference list. | ||
garbageAndRefList.clear(); | ||
|
||
// Run a concurrent mark cycle to mark all references but the static one as dead. | ||
wb.g1StartConcMarkCycle(); | ||
while (wb.g1InConcurrentMark()) { | ||
Thread.sleep(100); | ||
} | ||
|
||
// Run a young collection to make sure humongous object still can't be eagerly reclaimed. | ||
wb.youngGC(); | ||
// Will crash/assert if humongous object has been reclaimed. | ||
wb.fullGC(); | ||
} | ||
} |