6742641: G1: NullPointerException during GCOld
Summary: An update buffer is not processed correctly, which causes roots into the collection set not to be scanned and, hence, for the heap to be corrupted. The cause is that an object is accessed after it has been explicitly deleted, which causes a race.
Reviewed-by: jcoomes, ysr
--- a/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp Wed Sep 17 19:59:35 2008 +0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp Mon Sep 22 09:56:49 2008 -0400
@@ -208,12 +208,13 @@
nd->index, _sz,
true, worker_i);
void** buf = nd->buf;
+ size_t index = nd->index;
delete nd;
if (b) {
deallocate_buffer(buf);
return true; // In normal case, go on to next buffer.
} else {
- enqueue_complete_buffer(buf, nd->index, true);
+ enqueue_complete_buffer(buf, index, true);
return false;
}
} else {