Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2592

StackOverflowException when server not reachable with SocketAppender

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 2.11.0, 2.11.2
    • 2.12.0
    • Appenders
    • None

    Description

      SocketAppender crashes log4j with StackOverflowException when the server where the log file should be sent is not accessible. It looks like toString() contains recursion.

      This also happens in 2.11.2 (even though log shows 2.11.0).

      This does not happen in 2.8.2 ( toString() methods were not there in that version)

       

      java.lang.StackOverflowError: null
      at java.lang.Integer.toUnsignedString0(Integer.java:344) ~[?:?]
      at java.lang.Integer.toHexString(Integer.java:262) ~[?:?]
      at java.lang.Object.toString(Object.java:246) ~[?:?]
      at java.util.concurrent.CountDownLatch.toString(CountDownLatch.java:314) ~[?:?]
      at java.lang.String.valueOf(String.java:2951) ~[?:?]
      at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?]
      at org.apache.logging.log4j.core.net.TcpSocketManager$Reconnector.toString(TcpSocketManager.java:358) ~[log4j-core-2.11.0.jar:2.11.0]
      at java.lang.String.valueOf(String.java:2951) ~[?:?]
      at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?]
      at org.apache.logging.log4j.core.net.TcpSocketManager.toString(TcpSocketManager.java:495) ~[log4j-core-2.11.0.jar:2.11.0]
      at java.lang.String.valueOf(String.java:2951) ~[?:?]
      at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?]
      at org.apache.logging.log4j.core.net.TcpSocketManager$Reconnector.toString(TcpSocketManager.java:358) ~[log4j-core-2.11.0.jar:2.11.0]
      at java.lang.String.valueOf(String.java:2951) ~[?:?]
      at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?]
      at org.apache.logging.log4j.core.net.TcpSocketManager.toString(TcpSocketManager.java:495) ~[log4j-core-2.11.0.jar:2.11.0]
      at java.lang.String.valueOf(String.java:2951) ~[?:?]
      at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?]
      at org.apache.logging.log4j.core.net.TcpSocketManager$Reconnector.toString(TcpSocketManager.java:358) ~[log4j-core-2.11.0.jar:2.11.0]
      at java.lang.String.valueOf(String.java:2951) ~[?:?]
      at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?]
      at org.apache.logging.log4j.core.net.TcpSocketManager.toString(TcpSocketManager.java:495) ~[log4j-core-2.11.0.jar:2.11.0]
      at java.lang.String.valueOf(String.java:2951) ~[?:?]
      at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?]
      at org.apache.logging.log4j.core.net.TcpSocketManager$Reconnector.toString(TcpSocketManager.java:358) ~[log4j-core-2.11.0.jar:2.11.0]
      at java.lang.String.valueOf(String.java:2951) ~[?:?]
      at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?]
      at org.apache.logging.log4j.core.net.TcpSocketManager.toString(TcpSocketManager.java:495) ~[log4j-core-2.11.0.jar:2.11.0]
      at java.lang.String.valueOf(String.java:2951) ~[?:?]
      at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?]
      at org.apache.logging.log4j.core.net.TcpSocketManager$Reconnector.toString(TcpSocketManager.java:358) ~[log4j-core-2.11.0.jar:2.11.0]
      at java.lang.String.valueOf(String.java:2951) ~[?:?]
      at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?]
      at org.apache.logging.log4j.core.net.TcpSocketManager.toString(TcpSocketManager.java:495) ~[log4j-core-2.11.0.jar:2.11.0]
      at java.lang.String.valueOf(String.java:2951) ~[?:?]
      at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?]
      at org.apache.logging.log4j.core.net.TcpSocketManager$Reconnector.toString(TcpSocketManager.java:358) ~[log4j-core-2.11.0.jar:2.11.0]
      at java.lang.String.valueOf(String.java:2951) ~[?:?]
      at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?]
      at org.apache.logging.log4j.core.net.TcpSocketManager.toString(TcpSocketManager.java:495) ~[log4j-core-2.11.0.jar:2.11.0]
      at java.lang.String.valueOf(String.java:2951) ~[?:?]
      at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?]
      at org.apache.logging.log4j.core.net.TcpSocketManager$Reconnector.toString(TcpSocketManager.java:358) ~[log4j-core-2.11.0.jar:2.11.0]
      at java.lang.String.valueOf(String.java:2951) ~[?:?]
      at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?]
      at org.apache.logging.log4j.core.net.TcpSocketManager.toString(TcpSocketManager.java:495) ~[log4j-core-2.11.0.jar:2.11.0]
      at java.lang.String.valueOf(String.java:2951) ~[?:?]
      at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?]
      at org.apache.logging.log4j.core.net.TcpSocketManager$Reconnector.toString(TcpSocketManager.java:358) ~[log4j-core-2.11.0.jar:2.11.0]
      at java.lang.String.valueOf(String.java:2951) ~[?:?]
      at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?]
      at org.apache.logging.log4j.core.net.TcpSocketManager.toString(TcpSocketManager.java:495) ~[log4j-core-2.11.0.jar:2.11.0]
      at java.lang.String.valueOf(String.java:2951) ~[?:?]
      at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?]
      at 
      
      ...
      1000s of same messages repeated in between 
      ...
      
      org.apache.logging.log4j.core.net.TcpSocketManager$Reconnector.toString(TcpSocketManager.java:358) ~[log4j-core-2.11.0.jar:2.11.0]
      at java.lang.String.valueOf(String.java:2951) ~[?:?]
      at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?]
      at org.apache.logging.log4j.core.net.TcpSocketManager.toString(TcpSocketManager.java:495) ~[log4j-core-2.11.0.jar:2.11.0]
      

      Attachments

        Activity

          People

            ggregory Gary D. Gregory
            davidkaya.ysoft Dávid Kaya
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: