RFR: 8256916: Add JFR event for OutOfMemoryError

Erik Gahlin egahlin at openjdk.java.net
Thu Jan 14 14:43:04 UTC 2021


On Wed, 13 Jan 2021 14:26:39 GMT, Yasumasa Suenaga <ysuenaga 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.
>
> This PR passed all tests in jdk/jfr on Linux x64.

I don't have time to look at this now, I need to fix some high priority issues for JDK 16, but the problem is with C2. Several people have looked at this before.

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

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


More information about the hotspot-jfr-dev mailing list