RFR: 8036699: Add trace event when a metaspace allocation fails

Stefan Karlsson stefan.karlsson at oracle.com
Thu Mar 6 09:26:26 UTC 2014


On 2014-03-06 10:00, Erik Helin wrote:
> Hi all,
>
> this patch adds the new trace event 
> vm/gc/metaspace/allocation_failure. The event will be sent when we get 
> an allocation failure in metaspace. The event will contain the 
> following information:
> - classLoader - the class loader doing the allocation
> - anonymousClassLoader - if the classLoader is anonymous
> - nativeStackTrace - a VM stack trace (see more below)
> - metadataType - the kind of metadata (class or non-class)
> - metaspaceObjectType - the kind of metaspace object
>
> The field nativeStackTrace will contain a string representation of the 
> Threads C frames (up until the first Java frame). This is very useful 
> for debugging metaspace allocation failures coming from VM internals 
> such as the interpreter or GC code.
>
> I would especially appreciate if someone could look over the code in 
> metaspaceTracer.cpp performing the stack walking.
>
> Webrev:
> http://cr.openjdk.java.net/~ehelin/8036699/webrev.00/

I'm not going to review the stack walking code, but the rest looks good.

Some thoughts:

1) I wonder if the reported field "classLoader" should be reported as 
classLoaderClass instead?

http://cr.openjdk.java.net/~ehelin/8036699/webrev.00/src/share/vm/trace/trace.xml.udiff.html

+      <value type="CLASS" field="classLoader" label="Class Loader" />


2) Should we report the Host Class Loader Klass for anonymous classes, 
instead of reporting NULL?

thanks,
StefanK

>
> Enhancement:
> https://bugs.openjdk.java.net/browse/JDK-8036699
>
> Testing:
> - JFR JTREG tests
> - JPRT
> - Manual stress testing of the stack walking code by writing small test
>   programs that causes metaspace allocation failures from both Java
>   threads and non-Java threads.
>
> Thanks,
> Erik



More information about the hotspot-dev mailing list