Struts 2, Thread Locals reported by Tomcat after web application is stopped
---------------------------------------------------------------------------
Key: WW-3772
URL: https://issues.apache.org/jira/browse/WW-3772
Project: Struts 2
Issue Type: Bug
Components: Dispatch Filter, Other
Affects Versions: 2.3.1.2, 2.2.3.1, 2.1.8.1
Environment: Windows 7, Struts 2.1.8.1/2.2.3.1/2.2.1.3, Spring 3.0.1
Reporter: Tom Kimzey
Priority: Minor
When stopping or undeploying my struts 2 web app in Tomcat (7.0.23) I get
several severe warnings from tomcat:
SEVERE: The web application [/myapp] created a ThreadLocal with key of type
[com.opensymphony.xwork2.inject.ContainerImpl$10] (value
[com.opensymphony.xwork2.inject.ContainerImpl$10@1376afa]) and a value of type
[java.lang.Object[]] (value [[Ljava.lang.Object;@15075f9]) 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.
I've hunted all over the web and found this error repeated in several places,
but I haven't yet found a solution. I then found some posts that lead me to
believe this was a problem in the xwork libs but that it had been resolved in
the latest version:
http://jira.opensymphony.com/browse/XW-560
I also found a reference suggesting this could be a problem with using the
deprecated FilterDispatcher rather than a StrutsPrepareAndExecuteFilter:
https://issues.apache.org/jira/browse/WW-2167
I was originally using Struts 2.1.8.1 and upgraded to the latest (2.3.1.2)
which didn't solve the problem, nor did switching back and forth between the
FilterDispatcher and StrutsPrepareAndExecuteFilter.
I also tried an IntrospectorCleanupListener as a shot in the dark but to no
avail.
If I comment out the StrutsPrepareAndExecuteFilter and deploy/stop the web app,
the severe warnings regarding ThreadLocals go away (though obviously my web app
no longer works).
I sought further advice on the Struts 2 user mailing list as well as a couple
web forums but didn't get any further suggestions other than to file a bug on
JIRA.
It seems at least a few others are experiencing the same issue. From my
experimentation it seems something related to the StrutsPrepareAndExecuteFilter
starts off threads on startup but they are not shut down properly. I could not
find any documentation on additional cleanup I might perform force any threads
started by struts to shutdown.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira