Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8153413

Exceptions::_throw always logs exceptions, penalizing performance

XMLWordPrintable

    • b10

      See:

      void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exception, const char* message) {
        ...
        // vm log
        if (LogEvents){
          Events::log_exception(thread, "Exception <%s%s%s> (" INTPTR_FORMAT ") thrown at [%s, line %d]",
                                h_exception->print_value_string(), message ? ": " : "", message ? message : "",
                                p2i(h_exception()), file, line);
        }

      Note that LogEvents is "true"! Therefore, the patch for JDK-8076161 is actually incomplete. This logging does backfire at least when exception is coming from implicit null check, like in JDK-8076161, or from the native code, like in the benchmark below. Turning LogEvents off improves performance by a lot.

      Benchmark:
       http://cr.openjdk.java.net/~shade/8153413/StatBench.java

      Runnable JAR:
       http://cr.openjdk.java.net/~shade/8153413/benchmarks.jar

      Events::log_exception seems to record the exception into VM's ring buffer to provide diagnostics during the crash. There are other log messages there, but exceptions logging is special in two regards: a) exceptions may be much more frequent than other events, e.g. redefinitions or deopts; b) we are not capturing most exceptions that are coming from the generated code anyway!

      Therefore, I would suggest we drop Events::log_exception facility, or at least remove its usage at Exceptions::_throw.

            coleenp Coleen Phillimore
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: