Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1027

Circular Referenced Suppressed Exception Throws StackOverflowError

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.1.2, 1.3.0-alpha0
    • Fix Version/s: 1.3.0-alpha6
    • Component/s: logback-classic
    • Labels:
      None
    • Environment:

      All

      Description

      If an exception with a circular-referenced-suppressed exception is logged, logback will throw a StackOverflowError:

      Exception e1 = new Exception();
      Exception e2 = new Exception();
      e2.addSuppressed(e1);
      e1.addSuppressed(e2);
      LoggerFactory.getLogger("root").error("Error", e1);
      

      Will throw the following:

      Exception in thread "main" java.lang.StackOverflowError
      	at java.lang.ReflectiveOperationException.<init>(ReflectiveOperationException.java:89)
      	at java.lang.reflect.InvocationTargetException.<init>(InvocationTargetException.java:72)
      	at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)	at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:483)
      	at ch.qos.logback.classic.spi.ThrowableProxy.<init>(ThrowableProxy.java:69)
      	at ch.qos.logback.classic.spi.ThrowableProxy.<init>(ThrowableProxy.java:75)
      	at ch.qos.logback.classic.spi.ThrowableProxy.<init>(ThrowableProxy.java:75)
      	...
      

      A simple stack trace printout will produce the following:

      java.lang.Exception
      	at NewClass.main(NewClass.java:95)
      	Suppressed: java.lang.Exception
      		at NewClass.main(NewClass.java:96)
      	[CIRCULAR REFERENCE:java.lang.Exception]
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ceki Ceki Gülcü
                Reporter:
                nmccloud Kenneth Gendron
              • Votes:
                14 Vote for this issue
                Watchers:
                16 Start watching this issue

                Dates

                • Created:
                  Updated: