[
https://issues.jboss.org/browse/LOGMGR-99?page=com.atlassian.jira.plugin....
]
James Livingston updated LOGMGR-99:
-----------------------------------
Attachment: logmgr99.war
This is a simple reproducer (works on both JBoss EAP and WildFly). It contains a simple
servlet which logs a RuntimeException, and two fake class files
(org.wildfly.extension.undertow.deployment.UndertowDeploymentService and
org.jboss.threads.JBossThread) which contain text not a class.
When guessClass() tried to load the class Modules will attempt to log the fact and
triggers the recursion.
Infinite recursion when exception stack frame class lookup fails
----------------------------------------------------------------
Key: LOGMGR-99
URL:
https://issues.jboss.org/browse/LOGMGR-99
Project: JBoss Log Manager
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 1.5.1.Final
Reporter: James Livingston
Assignee: David Lloyd
Priority: Critical
Attachments: logmgr99.war
To print out the jar information in exception stack traces, the log manager needs to
resolve the class name from StackTraceElement to the Class object. Since the log manager
cannot know which classloader was used, guessClass() tries the TCCL, the logmanager's
classloader and finally the system classloader.
It is possible that the TCCL contains a class of the same name as the one in the stack
frame, but it not the same class. This can easily happen if the application packages a jar
that is also used by the container. In this situation, the class may not be able to be
loaded, such as if the application-packages class is missing it's dependencies.
If Class.forName() would throw a NoClassDefFoundError or similar, JBoss Modules (or other
classloader implementation) may attempt to log this using java.util.logging API. This can
result in infinite recursion, for example
...
at org.jboss.logmanager.Logger.log(Logger.java:367)
at org.jboss.modules.log.JDKModuleLogger.doLog(JDKModuleLogger.java:109)
at
org.jboss.modules.log.JDKModuleLogger.classDefineFailed(JDKModuleLogger.java:194)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:401)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)
at
org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
at org.jboss.modules.Module.loadModuleClass(Module.java:527)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at
org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:266)
at org.jboss.logmanager.formatters.Formatters$12.guessClass(Formatters.java:578)
at
org.jboss.logmanager.formatters.Formatters$12.renderExtended(Formatters.java:421)
at org.jboss.logmanager.formatters.Formatters$12.renderRaw(Formatters.java:388)
at
org.jboss.logmanager.formatters.Formatters$JustifyingFormatStep.render(Formatters.java:150)
at
org.jboss.logmanager.formatters.MultistepFormatter.format(MultistepFormatter.java:86)
at org.jboss.logmanager.ExtFormatter.format(ExtFormatter.java:35)
at org.jboss.logmanager.handlers.WriterHandler.doPublish(WriterHandler.java:49)
at org.jboss.logmanager.ExtHandler.publish(ExtHandler.java:76)
at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:290)
at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:298)
at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:298)
at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:298)
at org.jboss.logmanager.Logger.logRaw(Logger.java:721)
at org.jboss.logmanager.Logger.logRaw(Logger.java:731)
at org.jboss.logmanager.Logger.log(Logger.java:367)
...
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira