What actions are allowed in an JVMTI ResourceExhausted event handler?

Thomas Stüfe thomas.stuefe at gmail.com
Tue Nov 13 20:50:21 UTC 2018


Hi all,

We have a client using CloudFoundry and its "jvmkill" agent. That is a
tiny JVMTI agent (see https://github.com/cloudfoundry/jvmkill) which
subscribes to the JVMTI ResourceExhausted Event. In the handler it
then does call JVMTI FollowReferences() to produce a heap histogram.

The thing is, at our client we seem to run out of Metaspace in a
compiler thread. That thread normally would swallow the Metaspace OOM
and just bailout from the compilation. But as part of the metaspace
OOME handling the ResourceExhausted event gets posted, the handler
then uses JVMTI FollowReferences() and attempts to print out the heap
histogram, then runs into a guarantee since the compiler thread cannot
call java methods.

My question is: are there any limitations about what one can do inside
a ResourceExhausted event handler?

I checked the https://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html
documentation, but I cannot find any mentioning of limitations in that
case.

Thanks and Best Regards, Thomas


More information about the serviceability-dev mailing list