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

Circular Exception cause throws StackOverflowError

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1, 2.3
    • Fix Version/s: 2.4
    • Component/s: None
    • Labels:
      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

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: