This commit is broken. There were merge conflicts in changes.xml that were not properly resolved. Please fix this asap.
Ralph > On Jun 29, 2018, at 7:53 PM, [email protected] wrote: > > Repository: logging-log4j2 > Updated Branches: > refs/heads/release-2.x b66f09c34 -> 377afa006 > > > LOG4J2-2362 ReusableObjectMessage memory leak > > ReusableObjectMessage would previously retain a reference to > the most recently logged object. > > > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo > Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/377afa00 > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/377afa00 > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/377afa00 > > Branch: refs/heads/release-2.x > Commit: 377afa006b5102c508f1e6578bc05da24385907f > Parents: b66f09c > Author: Carter Kozak <[email protected]> > Authored: Fri Jun 29 16:02:55 2018 -0400 > Committer: Carter Kozak <[email protected]> > Committed: Fri Jun 29 22:52:54 2018 -0400 > > ---------------------------------------------------------------------- > .../log4j/message/ReusableMessageFactory.java | 2 + > .../apache/logging/log4j/LambdaLoggerTest.java | 5 +- > .../core/EventParameterMemoryLeakTest.java | 10 +- > src/changes/changes.xml | 174 +++++++++++++++++++ > 4 files changed, 188 insertions(+), 3 deletions(-) > ---------------------------------------------------------------------- > > > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/377afa00/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableMessageFactory.java > ---------------------------------------------------------------------- > diff --git > a/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableMessageFactory.java > > b/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableMessageFactory.java > index d75ca01..c258045 100644 > --- > a/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableMessageFactory.java > +++ > b/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableMessageFactory.java > @@ -86,6 +86,8 @@ public final class ReusableMessageFactory implements > MessageFactory2, Serializab > public static void release(final Message message) { // LOG4J2-1583 > if (message instanceof ReusableParameterizedMessage) { > ((ReusableParameterizedMessage) message).reserved = false; > + } else if (message instanceof ReusableObjectMessage) { > + ((ReusableObjectMessage) message).set(null); > } > } > > > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/377afa00/log4j-api/src/test/java/org/apache/logging/log4j/LambdaLoggerTest.java > ---------------------------------------------------------------------- > diff --git > a/log4j-api/src/test/java/org/apache/logging/log4j/LambdaLoggerTest.java > b/log4j-api/src/test/java/org/apache/logging/log4j/LambdaLoggerTest.java > index f6d1623..b532171 100644 > --- a/log4j-api/src/test/java/org/apache/logging/log4j/LambdaLoggerTest.java > +++ b/log4j-api/src/test/java/org/apache/logging/log4j/LambdaLoggerTest.java > @@ -21,6 +21,7 @@ import java.util.ArrayList; > import java.util.List; > > import org.apache.logging.log4j.message.Message; > +import org.apache.logging.log4j.message.ReusableMessage; > import org.apache.logging.log4j.message.SimpleMessage; > import org.apache.logging.log4j.spi.AbstractLogger; > import org.apache.logging.log4j.util.Supplier; > @@ -46,7 +47,9 @@ public class LambdaLoggerTest { > this.fqcn = fqcn; > this.level = level; > this.marker = marker; > - this.message = message; > + this.message = (message instanceof ReusableMessage) ? > + ((ReusableMessage) message).memento() : > + message; > this.throwable = t; > } > } > > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/377afa00/log4j-core/src/test/java/org/apache/logging/log4j/core/EventParameterMemoryLeakTest.java > ---------------------------------------------------------------------- > diff --git > a/log4j-core/src/test/java/org/apache/logging/log4j/core/EventParameterMemoryLeakTest.java > > b/log4j-core/src/test/java/org/apache/logging/log4j/core/EventParameterMemoryLeakTest.java > index de99eef..d2106f9 100644 > --- > a/log4j-core/src/test/java/org/apache/logging/log4j/core/EventParameterMemoryLeakTest.java > +++ > b/log4j-core/src/test/java/org/apache/logging/log4j/core/EventParameterMemoryLeakTest.java > @@ -49,21 +49,27 @@ public class EventParameterMemoryLeakTest { > } > > @Test > + @SuppressWarnings("UnusedAssignment") // parameter set to null to allow > garbage collection > public void testParametersAreNotLeaked() throws Exception { > final File file = new File("target", > "EventParameterMemoryLeakTest.log"); > assertTrue("Deleted old file before test", !file.exists() || > file.delete()); > > final Logger log = LogManager.getLogger("com.foo.Bar"); > CountDownLatch latch = new CountDownLatch(1); > - log.info("Message with parameter {}", new > ParameterObject("paramValue", latch)); > + Object parameter = new ParameterObject("paramValue", latch); > + log.info("Message with parameter {}", parameter); > + log.info(parameter); > + parameter = null; > CoreLoggerContexts.stopLoggerContext(file); > final BufferedReader reader = new BufferedReader(new > FileReader(file)); > final String line1 = reader.readLine(); > final String line2 = reader.readLine(); > + final String line3 = reader.readLine(); > reader.close(); > file.delete(); > assertThat(line1, containsString("Message with parameter > paramValue")); > - assertNull("Expected only a single line", line2); > + assertThat(line2, containsString("paramValue")); > + assertNull("Expected only a two lines", line3); > GarbageCollectionHelper gcHelper = new GarbageCollectionHelper(); > gcHelper.run(); > try { > > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/377afa00/src/changes/changes.xml > ---------------------------------------------------------------------- > diff --git a/src/changes/changes.xml b/src/changes/changes.xml > index d9e0790..9fab226 100644 > --- a/src/changes/changes.xml > +++ b/src/changes/changes.xml > @@ -30,6 +30,177 @@ > - "update" - Change > - "remove" - Removed > --> > +<<<<<<< HEAD > +======= > + <release version="3.0.0" date="2018-xx-xx" description="GA Release > 3.0.0"> > + <action issue="LOG4J2-2171" dev="rmannibucau" type="add"> > + Allow to force LOG4J2 to use TCCL only. > + </action> > + <action issue="LOG4J2-1802" dev="mattsicker" type="add"> > + Convert documentation into AsciiDoc format. > + </action> > + <action issue="LOG4J2-2268" dev="rgoers" type="fix" due-to="Tilman > Hausherr"> > + Improve plugin error message when elements are missing. > + </action> > + <action issue="LOG4J2-2255" dev="rgoers" type="update"> > + Use Spotbugs instead of Findbugs. Minimum version is Java 8. > + </action> > + <action issue="LOG4J2-2224" dev="rpopma" type="update"> > + Renamed package core.util.datetime to core.time.internal.format to > clarify these classes are to be considered private. > + </action> > + <action issue="LOG4J2-2225" dev="rpopma" type="update"> > + Moved time-related classes from core.util to core.time. Classes > considered private moved to core.time.internal. > + </action> > + <action issue="LOG4J2-2228" dev="ggregory" type="update" due-to="Gary > Gregory"> > + Split off ZeroMq/JeroMq support into a new module log4j-jeromq. > + </action> > + <action issue="LOG4J2-2227" dev="ggregory" type="update" due-to="Gary > Gregory"> > + Split off Kafka support into a new module log4j-kafka. > + </action> > + <action issue="LOG4J2-2230" dev="ggregory" type="update" due-to="Gary > Gregory"> > + Split off SMTP support into a new module log4j-smtp. > + </action> > + <action issue="LOG4J2-2231" dev="ggregory" type="update" due-to="Gary > Gregory"> > + Move CSV layout from log4j-core to a new module log4j-csv. > + </action> > + <action issue="LOG4J2-2232" dev="ggregory" type="update" due-to="Gary > Gregory"> > + Move JMS code to a new module log4j-jms. > + </action> > + <action issue="LOG4J2-2233" dev="ggregory" type="update" due-to="Gary > Gregory"> > + Move JDBC code to a new module log4j-jdbc. > + </action> > + <action issue="LOG4J2-2244" dev="ggregory" type="fix" due-to="Gary > Gregory"> > + org.apache.logging.log4j.core.lookup.EnvironmentLookup may throw NPE. > + </action> > + <action issue="LOG4J2-2237" dev="ggregory" type="update" due-to="Gary > Gregory"> > + Move Jackson-based layouts to their own modules: JSON, XML, and YAML. > + </action> > + <action issue="LOG4J2-2082" dev="ggregory" type="update" due-to="Gary > Gregory"> > + Update Apache Flume from 1.7.0 to 1.8.0. > + </action> > + <action issue="LOG4J2-2079" dev="ggregory" type="update" due-to="Gary > Gregory"> > + Update Conversant Disruptor from 1.12.10 to 1.12.11. > + </action> > + <action issue="LOG4J2-2258" dev="ggregory" type="update" due-to="Gary > Gregory"> > + Update LMAX Disruptor from 3.3.7 to 3.3.8. > + </action> > + <action issue="LOG4J2-2083" dev="ggregory" type="update" due-to="Gary > Gregory"> > + Update Eclipse javax.persistence from 2.1.1 to 2.2.0. > + </action> > + <action issue="LOG4J2-2083" dev="ggregory" type="update"> > + Update build to expect Java 8 sources and generate Java 8 byte codes. > + </action> > + <action issue="LOG4J2-2259" dev="ggregory" type="update"> > + Update MongoDB 3 module from driver 3.6.1 to 3.6.3. > + </action> > + <action issue="LOG4J2-2260" dev="ggregory" type="update"> > + [SMTP] Update javax.mail from 1.6.0 to 1.6.1. > + </action> > + <action issue="LOG4J2-2270" dev="ggregory" type="fix" due-to="Cyril > Martin"> > + Strings::join, when called with [null] returns "null" instead of > EMPTY. > + </action> > + <action issue="LOG4J2-2276" dev="ggregory" type="fix" due-to="Sean > Baxter"> > + ConcurrentModificationException from > org.apache.logging.log4j.status.StatusLogger.<clinit>(StatusLogger.java:71). > + </action> > + <action issue="LOG4J2-2274" dev="ggregory" type="fix" > due-to="Sebastien Lannez"> > + Allow EnvironmentPropertySource to run with a SecurityManager that > rejects environment variable access. > + </action> > + <action issue="LOG4J2-2279" dev="ggregory" type="fix" due-to="Gary > Gregory"> > + Allow SystemPropertiesPropertySource to run with a SecurityManager > that rejects system property access. > + </action> > + <action issue="LOG4J2-2279" dev="ggregory" type="fix" due-to="Remko > Popma"> > + Move ProcessIdUtil from log4j-api to log4j-core. > + </action> > + <action issue="LOG4J2-2283" dev="ggregory" type="fix" due-to="Vishnu > Priya Matha"> > + ParserConfigurationException when using Log4j with > oracle.xml.jaxp.JXDocumentBuilderFactory. > + </action> > + <action issue="LOG4J2-2300" dev="ggregory" type="fix"> > + PoolingDriverConnectionSource does not take into account properties, > user name, and password. > + </action> > + <action issue="LOG4J2-2302" dev="ggregory" type="update"> > + Status logger should show the Log4j name and version when > initializing itself. > + </action> > + <action issue="LOG4J2-2304" dev="ggregory" type="update" > due-to="wumengsheng"> > + Log4j2 2.8.2 JMX unregister NullPointerException. > + </action> > + <action issue="LOG4J2-2306" dev="ckozak" type="fix"> > + FixedDateFormat parses timezone offsets, -8:00 is interpreted as > GMT-8:00. > + </action> > + <action issue="LOG4J2-2307" dev="ckozak" type="fix"> > + MutableLogEvent and RingBufferLogEvent message mementos retain the > original format string. > + </action> > + <action issue="LOG4J2-2032" dev="ckozak" type="fix" due-to="Kostiantyn > Shchepanovskyi"> > + Curly braces in parameters are not treated as placeholders. > + </action> > + <action issue="LOG4J2-2311" dev="ggregory" type="update"> > + Update Jackson from 2.9.4 to 2.9.5. > + </action> > + <action issue="LOG4J2-2313" dev="ggregory" type="update"> > + Update LMAX Disruptor from 3.3.8 to 3.4.2. > + </action> > + <action issue="LOG4J2-2317" dev="ckozak" type="fix"> > + MutableLogEvent.getNonNullImmutableMessage and > Log4jLogEvent.makeMessageImmutable retain format and parameters. > + </action> > + <action issue="LOG4J2-2318" dev="ckozak" type="fix"> > + Messages are no longer mutated when the asynchronous queue is full. > A warning is logged to the status logger instead. > + </action> > + <action issue="LOG4J2-2320" dev="ckozak" type="fix"> > + Fix NPE in AbstractLogger when another exception is thrown, masking > the root cause. > + </action> > + <action issue="LOG4J2-548" dev="ggregory" type="update" > due-to="Shehata, Paresh Varke, Eric Victorson, Martin Laforet"> > + Log4j 2.0 ERROR "Could not search jar" with JBoss EAP 6.2. > + </action> > + <action issue="LOG4J2-2321" dev="ckozak" type="fix"> > + AsyncLogger uses the correct level when unspecified. This provides > parity between AsyncLogger and Logger. > + </action> > + <action issue="LOG4J2-2322" dev="ckozak" type="fix"> > + Custom ContextSelector implementations which select an > AsyncLoggerContext disable LoggerConfig.includeLocation > + by default for parity with AsyncLoggerContextSelector. > + </action> > + <action issue="LOG4J2-2269" dev="ckozak" type="fix"> > + MutableLogEvent references to other objects are cleared after each > use. > + Fix a memory leak causing references to parameters to be held after > synchronous logging with thread locals enabled. > + </action> > + <action issue="LOG4J2-2328" dev="ggregory" type="update"> > + Update JAnsi from 1.17 to 1.17.1. > + </action> > + <action issue="LOG4J2-2301" dev="ckozak" type="fix"> > + Mixed async loggers no longer forget parameter values, providing > some appenders with an array of nulls. > + </action> > + <action issue="LOG4J2-2331" dev="ckozak" type="fix" due-to="Mike > Baranski"> > + RollingFileManager debug logging avoids string concatenation and > errant braces in favor of parameterized logging. > + </action> > + <action issue="LOG4J2-2333" dev="ckozak" type="fix"> > + Handle errors thrown in default disruptor ExceptionHandler > implementations to avoid killing background threads. > + </action> > + <action issue="LOG4J2-2334" dev="ggregory" type="fix"> > + Add API > org.apache.logging.log4j.core.appender.AsyncAppender.getQueueSize(). > + </action> > + <action issue="LOG4J2-2336" dev="ckozak" type="fix"> > + Remove duplicate hyphen from the AsyncLoggerConfig background thread > name. > + </action> > + <action issue="LOG4J2-2347" dev="ggregory" type="fix"> > + Update Apache Commons Compress from 1.16.1 to 1.17. > + </action> > + <action issue="LOG4J2-2351" dev="ckozak" type="update"> > + Added AbstractLogEvent.getMutableInstant to allow the MutableInstant > instance to be modified by classes extending AbstractLogEvent. > + </action> > + <action issue="LOG4J2-2352" dev="ckozak" type="fix"> > + RingBufferLogEvent memento messages provide the expected format > string, and no longer attempt to substitute parameters into curly braces in > parameter toString values. > + Both RingBufferLogEvent and MutableLogEvent memento implementations > memoize results to avoid rebuilding formatted string values. > + </action> > + <action issue="LOG4J2-2355" dev="ckozak" type="fix" due-to="Henrik > Brautaset Aronsen"> > + PropertiesUtil ignores non-string system properties. Fixes a > NoClassDefFoundError initializing StatusLogger > + caused by an NPE while initializing the static PropertiesUtil field. > + </action> > + <action issue="LOG4J2-2357" dev="ggregory" type="update"> > + Update Jackson from 2.9.5 to 2.9.6. > + </action> > + <action issue="LOG4J2-2362" dev="ckozak" type="fix"> > + Fixed a memory leak in which ReusableObjectMessage would hold a > reference to the most recently logged object. > + </action> > + </release> > +>>>>>>> 063e725b8... LOG4J2-2362 ReusableObjectMessage memory leak > <release version="2.11.1" date="2018-MM-DD" description="GA Release > 2.11.1"> > <action issue="LOG4J2-2268" dev="rgoers" type="fix" due-to="Tilman > Hausherr"> > Improve plugin error message when elements are missing. > @@ -119,6 +290,9 @@ > <action issue="LOG4J2-2358" dev="ggregory" type="update"> > Update Kafka client from 1.0.0 to 1.1.0. > </action> > + <action issue="LOG4J2-2362" dev="ckozak" type="fix"> > + Fixed a memory leak in which ReusableObjectMessage would hold a > reference to the most recently logged object. > + </action> > </release> > <release version="2.11.0" date="2018-03-11" description="GA Release > 2.11.0"> > <action issue="LOG4J2-2104" dev="rgoers" type="fix"> > >
