src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp
changeset 58918 c727d5d4c22e
parent 58543 a7a606f6311c
child 59248 e92153ed8bdc
--- a/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp	Mon Nov 04 13:13:34 2019 -0500
+++ b/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp	Mon Nov 04 19:40:58 2019 +0100
@@ -238,6 +238,15 @@
     return;
   }
 
+  // Threads that are attaching should not block at all: they are not
+  // fully initialized yet. Calling sleep() on them would be awkward.
+  // This is probably the path that allocates the thread oop itself.
+  // Forcefully claim without waiting.
+  if (JavaThread::current()->is_attaching_via_jni()) {
+    claim_for_alloc(words, true);
+    return;
+  }
+
   size_t max = ShenandoahPacingMaxDelay;
   double start = os::elapsedTime();