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

Circular Exception cause throws StackOverflowError

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1, 2.3
    • 2.4
    • None
    • None

    Description

      If an exception with a circular-referenced exception (suppressed, or otherwise) is logged, log4j will throw a StackOverflowError:

              Exception e1 = new Exception();
              Exception e2 = new Exception(e1);
              e1.initCause(e2);
              LogManager.getLogger().error("Error", e1);
      

      Will throw the following:

      java.lang.StackOverflowError
      	at java.util.Vector.elementData(Vector.java:730)
      	at java.util.Vector.elementAt(Vector.java:473)
      	at java.util.Stack.peek(Stack.java:103)
      	at org.apache.logging.log4j.core.impl.ThrowableProxy.toExtendedStackTrace(ThrowableProxy.java:555)
      	at org.apache.logging.log4j.core.impl.ThrowableProxy.<init>(ThrowableProxy.java:147)
      	at org.apache.logging.log4j.core.impl.ThrowableProxy.<init>(ThrowableProxy.java:148)
      	at org.apache.logging.log4j.core.impl.ThrowableProxy.<init>(ThrowableProxy.java:148)
      	at org.apache.logging.log4j.core.impl.ThrowableProxy.<init>(ThrowableProxy.java:148)
      	at org.apache.logging.log4j.core.impl.ThrowableProxy.<init>(ThrowableProxy.java:148)
      	at org.apache.logging.log4j.core.impl.ThrowableProxy.<init>(ThrowableProxy.java:148)
      	at org.apache.logging.log4j.core.impl.ThrowableProxy.<init>(ThrowableProxy.java:148)
              ...
      

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            nmccloud Kenneth Gendron
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment