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

Circular Referenced Suppressed Exception Throws StackOverflowError

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.3.0-alpha10
    • 1.1.2, 1.3.0-alpha0
    • logback-classic
    • None
    • 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

        Activity

          People

            ceki Ceki Gülcü
            nmccloud Kenneth Gendron
            Votes:
            20 Vote for this issue
            Watchers:
            22 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: