You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ralph Goers (Jira)" <ji...@apache.org> on 2019/09/10 21:28:00 UTC

[jira] [Commented] (LOG4J2-2599) StackOverflowError between jul-binding and core

    [ https://issues.apache.org/jira/browse/LOG4J2-2599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16926903#comment-16926903 ] 

Ralph Goers commented on LOG4J2-2599:
-------------------------------------

I started to look into this when the issue was opened and I thought I had added comments. With Log4j 2.13.0 we will only be supporting Java 8+ so we could modify the code to use java.time instead of GregorianCalendar, but that wouldn't guarantee the problem would be fixed as the JDK is free to use the Platform Logger anywhere it wants to.  We need to build in some sort of circularity check for this.

> StackOverflowError between jul-binding and core
> -----------------------------------------------
>
>                 Key: LOG4J2-2599
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2599
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.11.2
>            Reporter: Björn Kautler
>            Priority: Major
>         Attachments: foo.zip
>
>
> The attached project shows a {{StackOverflowError}} between the JUL binding and the core artifact.
> To make the error happen with *this* showcase example you have to use Java 11 or Java 12. This is because this exact showcase depends on a bug that does not yet exist in Java 10 and is fixed in Java 13. But this does not mean the problem is on the JDK side, this bug is only a requirement for this showcase working as intended, but the bug could still be triggered by other bugfree code, I just happened to have the reproducer that depends on this bug.
> Setting the locale in this showcase is not relevant to Log4j, but to trigger the bug in the JDK that will show the problem.
> Basically the problem is, that during the {{org.apache.logging.log4j.LogManager.getLogger}} call Log4j wants to initialize the default logger with its default pattern, containing a {{%d}}. This causes a {{GregorianCalendar}} to be created. Due to the bug, the class wants to log something with the `PlatformLogger`, which is the essential part of the problem. Because due to the JUL binding, this fires back to Log4j which again wants to initialilze the default logger and the loop is closed until the stack flows over.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)