On May 19, 2013, at 3:33 AM, Mark Thomas wrote: > On 19/05/2013 05:57, Nick Williams wrote: >> Can one of the very knowledgeable developers that have been >> discussing memory leaks in the last few days (re: Possible >> false-postive with JreMemoryLeakPreventionListener and Tomcat's JDBC >> Pool and OracleTimeoutPollingThread) chime in on this Log4j 2 bug >> [1]? >> >> Log4j 2 appears to be registering a shutdown hook that, I believe, >> will result in a memory leak in Tomcat. The >> JreMemoryLeakPreventionListener does not detect it (which might be a >> separate Tomcat bug, assuming I'm right that it's a memory leak). I >> don't know nearly as much about class loaders and memory leaks in a >> web application as some of the guys I've read talking on here the >> last few days, and it would be helpful for us to get the >> knowledgeable opinion of one or more Tomcat developers about how to >> solve this. > > It looks like Ralph has already answered this [2]. > > If log4j2 is initialised by the webapp, it needs to be shutdown by the > webapp.
Ralph may have responded, but I don't believe it's the right answer. Log4j 1 never required a listener to be configured to be shut down properly when an application is undeployed. It should be possible to do this without a listener. Just a thought, is there a way to detect if a ClassLoader is being shut down/unloaded? Could a `finalize` method be used instead of a shutdown hook/listener? I'm fairly confident the finalize method would always be called when the application is undeployed (though I could be wrong). What I don't know is if it is guaranteed to be called in non-web applications when the JVM just shuts down. > >> (Note: I don't normally post to both lists, but since the memory leak >> topic was occurring on the user's list, and I also wanted to get the >> attention of as many developers as possible, I made an exception this >> time.) > > No matter how important you think your issue is, please do not cross > post. As a general guide, if you aren't sure, use the users list. The > committers are all active or lurking here so they will all see it and > will move the discussion to the dev list of necessary. My apologies. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
