# HG changeset patch # User tonyp # Date 1222091809 14400 # Node ID 919e7959392ab988bf5fd555f38c1f838fb897c4 # Parent 032ddb9432adb9027f2e0429336b897f6ed4b6a1 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 diff -r 032ddb9432ad -r 919e7959392a src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp --- a/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp Wed Sep 17 19:59:35 2008 +0400 +++ b/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 {