Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2490

thread blocked when logging numerous exception stack

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.7
    • None
    • Servers
    • None

    Description

      many thread blocked when logging a lot of exception, I found the reason is a java optimize to reflection.

      The first 15 runs (by default) of your reflected method is called using JNI; after that, bytecode is generated and calling that reflected method would perform identically to calling that method directly in Java code.

      ThrowableProxy.toExtendedStackTrace, the method will load class, and get jar package info, when it process a optimized reflected method, it will use classloaders but never found the class such as sun.reflect.GeneratedMethodAccessor119, in this process it  will try to load class from jar file every time  and spend so much cost. Worse, have a lock when loadClass, when many threads run this method, thread blocked.

       

      here is a article detailed this problem: https://translate.google.com/translate?hl=en&sl=zh-CN&tl=en&u=https%3A%2F%2Fblog.fliaping.com%2Fa-high-concurrency-problem-of-log4j2%2F

      Attachments

        Activity

          People

            Unassigned Unassigned
            fliaping Payne Xu
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated: