wyona / yanel

http://www.yanel.org
Apache License 2.0
10 stars 5 forks source link

Yanel should shut down all threads #58

Open michaelwechner opened 11 years ago

michaelwechner commented 11 years ago

Looking at local/apache-tomcat-7.0.25/logs/catalina.out while shutting down Yanel reveals that not all threads are being stopped:

05.06.2013 23:18:32 org.apache.catalina.core.StandardServer awaitINFO: A valid shutdown command was received via the shutdown port. Stopping the Server instance.05.06.2013 23:18:32 org.apache.coyote.AbstractProtocol pauseINFO: Pausing ProtocolHandler ["http-bio-8080"] 05.06.2013 23:18:32 org.apache.coyote.AbstractProtocol pause INFO: Pausing ProtocolHandler ["ajp-bio-8009"]05.06.2013 23:18:32 org.apache.catalina.core.StandardService stopInternalINFO: Stopping service Catalina05.06.2013 23:18:32 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SCHWERWIEGEND: The web application [/yanel] appears to have started a thread named [MyScheduler_Worker-1] but has failed to stop it. This is very likely to cr eate a memory leak. 05.06.2013 23:18:32 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SCHWERWIEGEND: The web application [/yanel] appears to have started a thread named [MyScheduler_Worker-2] but has failed to stop it. This is very likely to cr eate a memory leak. 05.06.2013 23:18:32 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SCHWERWIEGEND: The web application [/yanel] appears to have started a thread named [MyScheduler_Worker-3] but has failed to stop it. This is very likely to cr eate a memory leak. 05.06.2013 23:18:32 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks SCHWERWIEGEND: The web application [/yanel] created a ThreadLocal with key of type [org.apache.axis.utils.XMLUtils.ThreadLocalDocumentBuilder](value [org.apache.axis.utils.XMLUtils$ThreadLocalDocumentBuilder@3f29cfbb]) and a value of type [org.apache.xerces.jaxp.DocumentBuilderImpl](value [org.apache.xerces.jaxp.DocumentBuilderImpl@52051e62]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. 05.06.2013 23:18:32 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks SCHWERWIEGEND: The web application [/yanel] created a ThreadLocal with key of type [org.apache.axis.utils.XMLUtils.ThreadLocalDocumentBuilder](value [org.apache.axis.utils.XMLUtils$ThreadLocalDocumentBuilder@3f29cfbb]) and a value of type [org.apache.xerces.jaxp.DocumentBuilderImpl](value [org.apache.xerces.jaxp.DocumentBuilderImpl@4e0dddff]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. 05.06.2013 23:18:32 org.apache.coyote.AbstractProtocol stop INFO: Stopping ProtocolHandler ["http-bio-8080"] 05.06.2013 23:18:32 org.apache.coyote.AbstractProtocol stop INFO: Stopping ProtocolHandler ["ajp-bio-8009"] 05.06.2013 23:18:32 org.apache.coyote.AbstractProtocol destroy INFO: Destroying ProtocolHandler ["http-bio-8080"] 05.06.2013 23:18:32 org.apache.coyote.AbstractProtocol destroy INFO: Destroying ProtocolHandler ["ajp-bio-8009"]

Inside src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java#destroy() we should make sure that all threads are being stopped, because otherwise the Tomcat process might keep hanging!