You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by GitBox <gi...@apache.org> on 2020/09/25 03:38:24 UTC

[GitHub] [logging-log4j2] wuqian0808 commented on pull request #426: Avoid kafka thread leak - LOG4J2-2916

wuqian0808 commented on pull request #426:
URL: https://github.com/apache/logging-log4j2/pull/426#issuecomment-698701854


   During reconfigure, LoggerContext will start new configuration and stop previous configuration. The firstime, prev is DefaultConfiguration, new configuration is eg: XmlConfiguration. Then the xml defined appender count in abstractmanager will be increased to 1. The nexttime reconfigure is called, xml defined appender count will be increased to 2. However the abstractmanager stop method will check if --count is <= 0. This cause the kafka producer thread never get stopped.
   
   So each time loggercontext config start, the kafkamanager will create new kafka producer thread although it has one producer instance already. And the producer thread will never get closed.
   
   The count is correct. It means the count of appenders using this manager. As we can see, the AbstarctManager will store a map of all static log4j2 managers. So during reconfigure, if managers is used by new config, the manager shouldn't be closed. Instead I just added a logic to check whether new kafka thread should be opended.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org