This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new 05664f3 Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63836 05664f3 is described below commit 05664f3a1addb03cf4b3e70803609d13cefb2e91 Author: Mark Thomas <ma...@apache.org> AuthorDate: Mon Oct 28 20:43:24 2019 +0100 Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63836 While the OOME was not observed in 8.5.x, the memory leak at the roto of the issue was still present. --- java/org/apache/catalina/startup/ContextConfig.java | 15 +++++++++++++++ webapps/docs/changelog.xml | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/java/org/apache/catalina/startup/ContextConfig.java b/java/org/apache/catalina/startup/ContextConfig.java index 4474fcf..0cc1b6a 100644 --- a/java/org/apache/catalina/startup/ContextConfig.java +++ b/java/org/apache/catalina/startup/ContextConfig.java @@ -1555,6 +1555,9 @@ public class ContextConfig implements LifecycleListener { entry = new DefaultWebXmlCacheEntry(webXmlDefaultFragment, globalTimeStamp, hostTimeStamp); hostWebXmlCache.put(host, entry); + // Add a Lifecycle listener to the Host that will remove it from + // the hostWebXmlCache once the Host is destroyed + host.addLifecycleListener(new HostWebXmlCacheCleaner()); } return webXmlDefaultFragment; @@ -2617,6 +2620,18 @@ public class ContextConfig implements LifecycleListener { } } + private static class HostWebXmlCacheCleaner implements LifecycleListener { + + @Override + public void lifecycleEvent(LifecycleEvent event) { + + if (event.getType() == Lifecycle.AFTER_DESTROY_EVENT) { + Host host = (Host) event.getSource(); + hostWebXmlCache.remove(host); + } + } + } + static class JavaClassCacheEntry { public final String superclassName; diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 5db3f80..71c0077 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -51,6 +51,10 @@ <bug>63832</bug>: Properly mark container as FAILED when a JVM error occurs on stop. (remm) </fix> + <fix> + <bug>63836</bug> Ensure that references to the Host object are cleared + once the Host instance is destroyed. (markt) + </fix> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org