JDK-8213331 : Add an assert that Metaspace::allocate should not be called in VM thread
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 12
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2018-11-03
  • Updated: 2019-06-20
  • Resolved: 2019-01-29
Related Reports
Relates :  
Description
MetaWord* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size,
                              MetaspaceObj::Type type, TRAPS) {
+ assert(!THREAD->is_VM_thread(), "metaspace allocation may cause GC, but GC cannot be started in VM thread")

Comments
Runtime Triage: This is not on our current list of priorities. We will consider this feature if we receive additional customer requirements.
29-01-2019

If metaspace allocation fails, it calls GC which then tries to do the allocation within the GC, so it can be called from the VMThread. I tried to think of how to change this at the time but there were reasons it was this way.
07-12-2018