From 050b9caba3b97934f1a1e9fd63f9ad6923d8a9a3 Mon Sep 17 00:00:00 2001 From: tonyp Date: Mon, 22 Sep 2008 09:56:49 -0400 Subject: [PATCH] 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 --- hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp b/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp index 53de081cc2..2815992429 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp @@ -208,12 +208,13 @@ apply_closure_to_completed_buffer_helper(int worker_i, 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 { -- GitLab