You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tom K <tk...@yahoo.com> on 2012/03/06 17:57:28 UTC

Help with problem: ThreadLocal left after stopping tomcat

Hello,


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  (the following is from my 
web.xml):
<filter>     <filter-name>action2</filter-name>         
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
 </filter>  <filter-mapping>     <filter-name>httpResponseFilter</filter-name>     
<url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping>     
<filter-name>springSecurityFilterChain</filter-name>     
<url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping>     
<filter-name>action2</filter-name>     <url-pattern>/*</url-pattern> 
</filter-mapping> 

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 ThreadLocal's go away (though  obviously my web 
app no longer works).

At this point I'm not sure what else to try - is there some  additional cleanup 
I can perform via a ContextLoaderListener or  otherwise on struts to shut it 
down properly when the web app is  stopped? Or are there still bugs in struts 
2/xwork causing this issue  that  haven't been resolved? 


Any suggestions or help much appreciated.
Thanks,
Tom 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Help with problem: ThreadLocal left after stopping tomcat

Posted by Tom K <tk...@yahoo.com>.
Aum,

Thanks for the reply - I haven't found a solution so I've taken your suggestion 
and filed a bug here:

https://issues.apache.org/jira/browse/WW-3772

Thanks,
Tom 

----- Original Message ----
From: Aum Strut <au...@gmail.com>
To: Struts Users Mailing List <us...@struts.apache.org>
Sent: Sun, March 11, 2012 10:51:00 PM
Subject: Re: Help with problem: ThreadLocal left after stopping tomcat

Tom,
If the issue still persist, i suggest you to open a JIRA ticket with
information about your use-case as it might be still be a bug

On Wed, Mar 7, 2012 at 7:47 PM, Tom K <tk...@yahoo.com> wrote:

> Thanks for the reply.
>
> Based on my experimentation it appears these threads are started by the
> Struts framework on startup. As I mentioned if I comment out my
> StrutsPrepareAndExecute filter
> and start/stop the app, I don't get any SEVERE warnings from tomcat.
>
> I can catch the Web Application shutdown by implementing a
> ContextLoaderListener
> and perform
> cleanup by overriding the contextDestroyed() method. However in my
> searching and
> reading so far
> I haven't found a solid clue as to what classes or beans struts uses I
> might
> explicitly try and get
> to and force cleanup on.
>
> Does anyone have any ideas?
>
> Thanks,
> Tom
>
>
>
> ----- Original Message ----
> From: Greg Lindholm <gr...@gmail.com>
> To: Struts Users Mailing List <us...@struts.apache.org>
> Sent: Wed, March 7, 2012 7:56:53 AM
> Subject: Re: Help with problem: ThreadLocal left after stopping tomcat
>
> I also get a boat-load of these ThreadLocal errors when I stop my app
> (using Tomcat 6).  Tomcat 6 & 7 are now checking and reporting on all the
> debris that gets left behind when an app shuts down.
>
> I don't think the WW-560 addresses this problem.
>
> If I understand it correctly the problem is when the app shuts down it is
> failing to cleanup some ThreadLocal variables. To fix this issue something
> would need to keep track of these variables and remove them when the app
> terminates. It also means it would need to either be notified about the
> shutdown or explicitly called to cleanup during shutdown.  Since these are
> ThreadLocal it could be a tricky problem.
>
>
>
> On Tue, Mar 6, 2012 at 11:57 AM, Tom K <tk...@yahoo.com> wrote:
>
> > Hello,
> >
> >
> > 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  (the following is
> from
> > my
> > web.xml):
> > <filter>     <filter-name>action2</filter-name>
> >
>
>><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
>>
> >>
> >  </filter>  <filter-mapping>
> > <filter-name>httpResponseFilter</filter-name>
> > <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping>
> > <filter-name>springSecurityFilterChain</filter-name>
> > <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping>
> > <filter-name>action2</filter-name>     <url-pattern>/*</url-pattern>
> > </filter-mapping>
> >
> > 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 ThreadLocal's go away (though  obviously my
> > web
> > app no longer works).
> >
> > At this point I'm not sure what else to try - is there some  additional
> > cleanup
> > I can perform via a ContextLoaderListener or  otherwise on struts to shut
> > it
> > down properly when the web app is  stopped? Or are there still bugs in
> > struts
> > 2/xwork causing this issue  that  haven't been resolved?
> >
> >
> > Any suggestions or help much appreciated.
> > Thanks,
> > Tom
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Help with problem: ThreadLocal left after stopping tomcat

Posted by Aum Strut <au...@gmail.com>.
Tom,
If the issue still persist, i suggest you to open a JIRA ticket with
information about your use-case as it might be still be a bug

On Wed, Mar 7, 2012 at 7:47 PM, Tom K <tk...@yahoo.com> wrote:

> Thanks for the reply.
>
> Based on my experimentation it appears these threads are started by the
> Struts framework on startup. As I mentioned if I comment out my
> StrutsPrepareAndExecute filter
> and start/stop the app, I don't get any SEVERE warnings from tomcat.
>
> I can catch the Web Application shutdown by implementing a
> ContextLoaderListener
> and perform
> cleanup by overriding the contextDestroyed() method. However in my
> searching and
> reading so far
> I haven't found a solid clue as to what classes or beans struts uses I
> might
> explicitly try and get
> to and force cleanup on.
>
> Does anyone have any ideas?
>
> Thanks,
> Tom
>
>
>
> ----- Original Message ----
> From: Greg Lindholm <gr...@gmail.com>
> To: Struts Users Mailing List <us...@struts.apache.org>
> Sent: Wed, March 7, 2012 7:56:53 AM
> Subject: Re: Help with problem: ThreadLocal left after stopping tomcat
>
> I also get a boat-load of these ThreadLocal errors when I stop my app
> (using Tomcat 6).  Tomcat 6 & 7 are now checking and reporting on all the
> debris that gets left behind when an app shuts down.
>
> I don't think the WW-560 addresses this problem.
>
> If I understand it correctly the problem is when the app shuts down it is
> failing to cleanup some ThreadLocal variables. To fix this issue something
> would need to keep track of these variables and remove them when the app
> terminates. It also means it would need to either be notified about the
> shutdown or explicitly called to cleanup during shutdown.  Since these are
> ThreadLocal it could be a tricky problem.
>
>
>
> On Tue, Mar 6, 2012 at 11:57 AM, Tom K <tk...@yahoo.com> wrote:
>
> > Hello,
> >
> >
> > 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  (the following is
> from
> > my
> > web.xml):
> > <filter>     <filter-name>action2</filter-name>
> >
>
> ><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
> >>
> >  </filter>  <filter-mapping>
> > <filter-name>httpResponseFilter</filter-name>
> > <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping>
> > <filter-name>springSecurityFilterChain</filter-name>
> > <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping>
> > <filter-name>action2</filter-name>     <url-pattern>/*</url-pattern>
> > </filter-mapping>
> >
> > 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 ThreadLocal's go away (though  obviously my
> > web
> > app no longer works).
> >
> > At this point I'm not sure what else to try - is there some  additional
> > cleanup
> > I can perform via a ContextLoaderListener or  otherwise on struts to shut
> > it
> > down properly when the web app is  stopped? Or are there still bugs in
> > struts
> > 2/xwork causing this issue  that  haven't been resolved?
> >
> >
> > Any suggestions or help much appreciated.
> > Thanks,
> > Tom
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Help with problem: ThreadLocal left after stopping tomcat

Posted by Tom K <tk...@yahoo.com>.
Thanks for the reply.

Based on my experimentation it appears these threads are started by the
Struts framework on startup. As I mentioned if I comment out my 
StrutsPrepareAndExecute filter
and start/stop the app, I don't get any SEVERE warnings from tomcat.

I can catch the Web Application shutdown by implementing a ContextLoaderListener 
and perform
cleanup by overriding the contextDestroyed() method. However in my searching and 
reading so far
I haven't found a solid clue as to what classes or beans struts uses I might 
explicitly try and get
to and force cleanup on. 

Does anyone have any ideas?

Thanks,
Tom 



----- Original Message ----
From: Greg Lindholm <gr...@gmail.com>
To: Struts Users Mailing List <us...@struts.apache.org>
Sent: Wed, March 7, 2012 7:56:53 AM
Subject: Re: Help with problem: ThreadLocal left after stopping tomcat

I also get a boat-load of these ThreadLocal errors when I stop my app
(using Tomcat 6).  Tomcat 6 & 7 are now checking and reporting on all the
debris that gets left behind when an app shuts down.

I don't think the WW-560 addresses this problem.

If I understand it correctly the problem is when the app shuts down it is
failing to cleanup some ThreadLocal variables. To fix this issue something
would need to keep track of these variables and remove them when the app
terminates. It also means it would need to either be notified about the
shutdown or explicitly called to cleanup during shutdown.  Since these are
ThreadLocal it could be a tricky problem.



On Tue, Mar 6, 2012 at 11:57 AM, Tom K <tk...@yahoo.com> wrote:

> Hello,
>
>
> 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  (the following is from
> my
> web.xml):
> <filter>     <filter-name>action2</filter-name>
>
><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
>>
>  </filter>  <filter-mapping>
> <filter-name>httpResponseFilter</filter-name>
> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping>
> <filter-name>springSecurityFilterChain</filter-name>
> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping>
> <filter-name>action2</filter-name>     <url-pattern>/*</url-pattern>
> </filter-mapping>
>
> 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 ThreadLocal's go away (though  obviously my
> web
> app no longer works).
>
> At this point I'm not sure what else to try - is there some  additional
> cleanup
> I can perform via a ContextLoaderListener or  otherwise on struts to shut
> it
> down properly when the web app is  stopped? Or are there still bugs in
> struts
> 2/xwork causing this issue  that  haven't been resolved?
>
>
> Any suggestions or help much appreciated.
> Thanks,
> Tom
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Help with problem: ThreadLocal left after stopping tomcat

Posted by Greg Lindholm <gr...@gmail.com>.
I also get a boat-load of these ThreadLocal errors when I stop my app
(using Tomcat 6).  Tomcat 6 & 7 are now checking and reporting on all the
debris that gets left behind when an app shuts down.

I don't think the WW-560 addresses this problem.

If I understand it correctly the problem is when the app shuts down it is
failing to cleanup some ThreadLocal variables. To fix this issue something
would need to keep track of these variables and remove them when the app
terminates. It also means it would need to either be notified about the
shutdown or explicitly called to cleanup during shutdown.  Since these are
ThreadLocal it could be a tricky problem.



On Tue, Mar 6, 2012 at 11:57 AM, Tom K <tk...@yahoo.com> wrote:

> Hello,
>
>
> 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  (the following is from
> my
> web.xml):
> <filter>     <filter-name>action2</filter-name>
>
> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
>  </filter>  <filter-mapping>
> <filter-name>httpResponseFilter</filter-name>
> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping>
> <filter-name>springSecurityFilterChain</filter-name>
> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping>
> <filter-name>action2</filter-name>     <url-pattern>/*</url-pattern>
> </filter-mapping>
>
> 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 ThreadLocal's go away (though  obviously my
> web
> app no longer works).
>
> At this point I'm not sure what else to try - is there some  additional
> cleanup
> I can perform via a ContextLoaderListener or  otherwise on struts to shut
> it
> down properly when the web app is  stopped? Or are there still bugs in
> struts
> 2/xwork causing this issue  that  haven't been resolved?
>
>
> Any suggestions or help much appreciated.
> Thanks,
> Tom
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>