You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2015/06/09 02:13:00 UTC
[jira] [Updated] (LOG4J2-934) Circular suppressed Exception throws
StackOverflowError
[ https://issues.apache.org/jira/browse/LOG4J2-934?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary Gregory updated LOG4J2-934:
--------------------------------
Summary: Circular suppressed Exception throws StackOverflowError (was: Circular Referenced Exception Throws StackOverflowError)
> Circular suppressed Exception throws StackOverflowError
> -------------------------------------------------------
>
> Key: LOG4J2-934
> URL: https://issues.apache.org/jira/browse/LOG4J2-934
> Project: Log4j 2
> Issue Type: Bug
> Affects Versions: 2.1
> Reporter: Kenneth Gendron
>
> If an exception with a circular-referenced exception (suppressed, or otherwise) is logged, log4j will throw a StackOverflowError:
> {code:java}
> Exception e1 = new Exception();
> Exception e2 = new Exception();
> e2.addSuppressed(e1);
> e1.addSuppressed(e2);
> LoggerFactory.getLogger("root").error("Error", e1);
> {code}
> Will throw the following:
> {code:java}
> Exception in thread "main" java.lang.StackOverflowError
> at java.util.HashMap.hash(HashMap.java:338)
> at java.util.HashMap.get(HashMap.java:556)
> at java.lang.ClassLoader.getPackage(ClassLoader.java:1608)
> at java.lang.Package.getPackage(Package.java:334)
> at java.lang.Class.getPackage(Class.java:783)
> at org.apache.logging.log4j.core.impl.ThrowableProxy.toCacheEntry(ThrowableProxy.java:495)
> at org.apache.logging.log4j.core.impl.ThrowableProxy.toExtendedStackTrace(ThrowableProxy.java:547)
> at org.apache.logging.log4j.core.impl.ThrowableProxy.<init>(ThrowableProxy.java:113)
> at org.apache.logging.log4j.core.impl.ThrowableProxy.toSuppressedProxies(ThrowableProxy.java:588)
> at org.apache.logging.log4j.core.impl.ThrowableProxy.<init>(ThrowableProxy.java:116)
> at org.apache.logging.log4j.core.impl.ThrowableProxy.toSuppressedProxies(ThrowableProxy.java:588)
> {code}
> A simple stack trace printout will produce the following:
> {code:java}
> java.lang.Exception
> at NewClass.main(NewClass.java:95)
> Suppressed: java.lang.Exception
> at NewClass.main(NewClass.java:96)
> [CIRCULAR REFERENCE:java.lang.Exception]
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org