RFR: 8256916: Add JFR event for OutOfMemoryError

Yasumasa Suenaga ysuenaga at openjdk.java.net
Wed Jan 13 14:16:02 UTC 2021


On Tue, 12 Jan 2021 21:45:32 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:

> The right way to do this is to emit the event when the exception is thrown and I think it must happen inside the VM.

I updated PR. Could you review?
Windows build on GitHub Actions failed, but it is not caused by this PR (due to configure error).

I removed bytecode injection to hook c'tor of `Error` and `Exception`. JavaErrorThrown and JavaExceptionThrown would be thrown from HotSpot. And also number of thrown is counted at HotSpot, so I added new JNI function to get it, it is used for ExceptionStatistics event.

> One problem is that the C2 compiler can eliminate the throw if it can prove the it can't be seen. That is the reason, we ended up with the current implementation many years ago. It was complicated to implement in the VM.

I added a function call which emits JavaErrorThrown and/or JavaExceptionThrown around `Exceptions::log_exception()` call. It is not completely solution for your concern, but we can hook most of throwable objects like unified logging.

-------------

PR: https://git.openjdk.java.net/jdk/pull/1403


More information about the hotspot-jfr-dev mailing list