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

Events::log_exception should limit the size of the logging message

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 24
    • 23
    • hotspot
    • b13

      To take an example, if we try to create a class with a name that exceeds the maximum allowed class name length of 65535 then the exception will limit the amount of information placed into the detail string (i.e. the name) but the internal event logging will try to print the whole thing. Depending on the actual size of the invalid name this can trigger a range of other failures (e.g. assertions) in other VM code. Here is a typical stacktrace:

      Stack: [0x00007f5133559000,0x00007f5133659000], sp=0x00007f51336567f0, free space=1013k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x12b50e8] outputStream::do_vsnprintf(char*, unsigned long, char const*, __va_list_tag*, bool, unsigned long&)+0x1f2 (ostream.cpp:105)
      V [libjvm.so+0x12b525f] outputStream::do_vsnprintf_and_write_with_automatic_buffer(char const*, __va_list_tag*, bool)+0x6d (ostream.cpp:129)
      V [libjvm.so+0x12b5376] outputStream::do_vsnprintf_and_write(char const*, __va_list_tag*, bool)+0x58 (ostream.cpp:143)
      V [libjvm.so+0x12b5422] outputStream::print(char const*, ...)+0xa8 (ostream.cpp:150)
      V [libjvm.so+0xb7d367] ExceptionsEventLog::log(Thread*, Handle, char const*, char const*, int)+0x241 (events.cpp:159)
      V [libjvm.so+0xb8188d] Events::log_exception(Thread*, Handle, char const*, char const*, int)+0x65 (events.hpp:322)
      V [libjvm.so+0xb7fc67] Exceptions::_throw(JavaThread*, char const*, int, Handle, char const*)+0x2e7 (exceptions.cpp:183)
      V [libjvm.so+0xb7fd30] Exceptions::_throw_msg(JavaThread*, char const*, int, Symbol*, char const*, Handle, Handle)+0xa8 (exceptions.cpp:194)
      V [libjvm.so+0xe6d887] jni_ThrowNew+0x1a9 (jni.cpp:539)
      C [libjava.so+0x1e9ed] JNU_ThrowByName+0x69 (jni_util.c:55)
      C [libjava.so+0x1ebcd] JNU_ThrowClassNotFoundException+0x39 (jni_util.c:93)
      C [libjava.so+0xf859] Java_java_lang_Class_forName0+0x202 (Class.c:141)

      We should limit the length of the logged information to avoid such problems.

            dholmes David Holmes
            dholmes David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: