[MAGNOLIA-6249] Eliminate log warnings and errors on server shutdown Created: 08/Jun/15 Updated: 13/Jan/17 |
|
| Status: | Accepted |
| Project: | Magnolia |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Daniel Lipp | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | OnDemand, devwl, estimate-with-uncertainty | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Template: |
|
||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||
| Task DoR: |
Empty
|
||||||||||||
| Story Points: | 8 | ||||||||||||
| Description |
|
When shutting down (or restarting) Magnolia e.g. in Tomcat 7 or 8, you'll see lots of exceptions (in development environment and in production set up): Jun 04, 2015 3:27:13 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc WARNING: The web application [] registered the JDBC driver [org.apache.derby.jdbc.AutoloadedDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. Jun 04, 2015 3:27:13 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads WARNING: The web application [] appears to have started a thread named [com.google.inject.internal.util.$Finalizer] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135) java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151) com.google.inject.internal.util.$Finalizer.run(Finalizer.java:114) Jun 04, 2015 3:27:13 PM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks SEVERE: The web application [] created a ThreadLocal with key of type [org.apache.log4j.helpers.ThreadLocalMap] (value [org.apache.log4j.helpers.ThreadLocalMap@54013ecf]) and a value of type [java.util.Hashtable] (value [{Referer=http://37.44.0.106:20100/.magnolia/admincentral, SessionId=73C323210648AF26B40EAE61A381C99B, Remote-Host=212.120.50.178, User-Agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/600.6.3 (KHTML, like Gecko) Version/8.0.6 Safari/600.6.3, requesturi=/.magnolia/admincentral/APP/global/0/legacy/1/graph1433431622625.png}]) 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. Jun 04, 2015 3:27:13 PM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks SEVERE: The web application [] created a ThreadLocal with key of type [com.vaadin.util.CurrentInstance$1] (value [com.vaadin.util.CurrentInstance$1@1dc2b31f]) and a value of type [java.util.HashMap] (value [{class com.vaadin.server.VaadinSession=com.vaadin.util.CurrentInstance@597dc77c, class com.vaadin.server.VaadinService=com.vaadin.util.CurrentInstance@50b3cbca, class com.vaadin.ui.UI=com.vaadin.util.CurrentInstance@4c08642a}]) 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. Jun 04, 2015 3:27:13 PM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks SEVERE: The web application [] created a ThreadLocal with key of type [org.apache.log4j.helpers.ThreadLocalMap] (value [org.apache.log4j.helpers.ThreadLocalMap@54013ecf]) and a value of type [java.util.Hashtable] (value [{Referer=http://37.44.0.106:20100/.magnolia/admincentral, SessionId=73C323210648AF26B40EAE61A381C99B, Remote-Host=212.120.50.178, User-Agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/600.6.3 (KHTML, like Gecko) Version/8.0.6 Safari/600.6.3, requesturi=/.magnolia/admincentral/UIDL/}]) 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. Might be that those are not hinting to real problems but already the fact they're flooding the logs is bad enough. |
| Comments |
| Comment by Daniel Lipp [ 08/Jun/15 ] |
|
We found how to fix the first entry (clearReferencesJdbc): see https://git.magnolia-cms.com/gitweb/?p=internal/ondemand.git;a=blob;f=src/main/java/info/magnolia/ondemand/init/OnDemandServletContextListener.java - inspired by http://stackoverflow.com/questions/27768122/how-to-fix-org-apache-derby-jdbc-autoloadeddriver-failed-to-unregister-on-tomcat Ideally this should go into info.magnolia.init.MagnoliaServletContextListener as it affects all installations. We'd of course then go back to use the default ServletContextListener. The thread related issues might be harder to solve. |
| Comment by Daniel Lipp [ 08/Jun/15 ] |
|
Obviously others spotted this problem as well. |