This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
     new cdfe4c7  Better fix for bug 63836
cdfe4c7 is described below

commit cdfe4c7458163bdbfc075506e2130ee7d928da0a
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Oct 28 20:29:00 2019 +0100

    Better fix for bug 63836
    
    Ensure ContextConfig does not retain a reference to a Host object once
    the Host has been destroyed.
---
 java/org/apache/catalina/startup/ContextConfig.java | 15 +++++++++++++++
 java/org/apache/tomcat/util/net/NioEndpoint.java    |  1 -
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/startup/ContextConfig.java 
b/java/org/apache/catalina/startup/ContextConfig.java
index 34764d6..91fb5f3 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -1511,6 +1511,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;
@@ -2792,6 +2795,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);
+            }
+        }
+    }
+
     private static class JavaClassCacheEntry {
         public final String superclassName;
 
diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java 
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 0eef5f6..eeeb6b8 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -592,7 +592,6 @@ public class NioEndpoint extends 
AbstractEndpoint<NioChannel> {
         nioChannels.clear();
         processorCache.clear();
         shutdownExecutor();
-        oomParachuteData = null;
     }
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to