Skip to content

Commit 415cfd2

Browse files
ashu-mehraPaul Hohensee
authored and
Paul Hohensee
committed
8297285: Shenandoah pacing causes assertion failure during VM initialization
Reviewed-by: rkennke, phh
1 parent df07255 commit 415cfd2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "gc/shenandoah/shenandoahPacer.hpp"
3030
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
3131
#include "runtime/atomic.hpp"
32+
#include "runtime/javaThread.inline.hpp"
3233
#include "runtime/mutexLocker.hpp"
3334
#include "runtime/threadSMR.hpp"
3435

@@ -241,7 +242,13 @@ void ShenandoahPacer::pace_for_alloc(size_t words) {
241242
// Threads that are attaching should not block at all: they are not
242243
// fully initialized yet. Blocking them would be awkward.
243244
// This is probably the path that allocates the thread oop itself.
244-
if (JavaThread::current()->is_attaching_via_jni()) {
245+
//
246+
// Thread which is not an active Java thread should also not block.
247+
// This can happen during VM init when main thread is still not an
248+
// active Java thread.
249+
JavaThread* current = JavaThread::current();
250+
if (current->is_attaching_via_jni() ||
251+
!current->is_active_Java_thread()) {
245252
return;
246253
}
247254

0 commit comments

Comments
 (0)