--- old/src/share/vm/gc/shenandoah/shenandoahHeap.inline.hpp 2016-12-19 17:24:26.923567856 +0100 +++ new/src/share/vm/gc/shenandoah/shenandoahHeap.inline.hpp 2016-12-19 17:24:26.844568853 +0100 @@ -252,6 +252,14 @@ alloc_from_gclab = false; } +#ifdef ASSERT + // Checking that current Java thread does not hold Threads_lock when we get here. + // If that ever be the case, we'd deadlock in oom_during_evacuation. + if ((! Thread::current()->is_GC_task_thread()) && (! Thread::current()->is_ConcurrentGC_thread())) { + assert(! Threads_lock->owned_by_self(), "must not hold Threads_lock here"); + } +#endif + if (filler == NULL) { oom_during_evacuation(); // If this is a Java thread, it should have waited