You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by neeraj kumar <ne...@gmail.com> on 2011/03/22 15:42:21 UTC
Advantages of using tomcat manager over the conventional approach of copy-it-to-deploy/undeploy
Hi ,
I am using Tomcat 6.0.18 , JVM Version 1.6.0_24 ,OS SunOS 5.10, OSArch
:AMD64
Recently I observed in few apps deployed on tomcat, that when I undeploy the
apps by simply deleting the .war file and the directory for the app, a few
threads are not cleaned up.
I would be happy if someone shed some light on the following:
1, Is there a way of a full clean undeployment of a webapp ?
2. Does tomcat manager help the developer/administrator in a full cleanup of
an app during undeployment , or even the manager simply deletes the war and
lets the tomcat container take care of undeploying??
Thanks
---
Neeraj
Re: Advantages of using tomcat manager over the conventional approach
of copy-it-to-deploy/undeploy
Posted by neeraj kumar <ne...@gmail.com>.
Hi Mark,
Thanks for the prompt reply.
On Thu, Mar 24, 2011 at 5:33 PM, Mark Thomas <ma...@apache.org> wrote:
> On 24/03/2011 11:14, neeraj kumar wrote:
> > Hi Mark,
> >
> > I have a multiwar app.
>
> That isn't ideal. Web applications are intended to be self-contained.
>
> The apps are logically exclusive, just that the platform is such that , it
allows developers to create widgets in one app, which can access data in
another.
> > I made the changes to one war in myway/META-INF/context.xml
> >
> > <Context path="/mywar" clearReferencesStopThreads="true"
> > clearReferencesThreadLocals="true">
> >
> > </Context>
> >
> > The issue is:
> >
> > 1.When I use tomcat manager to deploy the war, it doesn't respect the
> path
> > attribute of the war. i.e my war is by the name
> > mywar-R10-SNAPSHOT.war, so the context is set as mywar-R10-SNAPSHOT
> rather
> > than just mywar.
>
> As expected. Read the docs for the Context element.
>
> > 2. How can I confirm if clearReferencesStopThread and
> > clearReferencesThreadLocals attributes are being respected or not??
>
> If they do anything, there will be a message in the log on context stop.
> However, you are using 6.0.18 (current 6.0.x version is 6.0.32 and there
> is also 7.0.11) and I don't believe those options are available in 6.0.18.
>
> I will upgrade my tomcat version and see if things change.
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Also, just out of curiosity, I was wondering what race conditions could
occur while undeployment etc.
And how the manager takes care of those.
Thanks
--
Neeraj
Re: Advantages of using tomcat manager over the conventional approach
of copy-it-to-deploy/undeploy
Posted by Mark Thomas <ma...@apache.org>.
On 24/03/2011 11:14, neeraj kumar wrote:
> Hi Mark,
>
> I have a multiwar app.
That isn't ideal. Web applications are intended to be self-contained.
> I made the changes to one war in myway/META-INF/context.xml
>
> <Context path="/mywar" clearReferencesStopThreads="true"
> clearReferencesThreadLocals="true">
>
> </Context>
>
> The issue is:
>
> 1.When I use tomcat manager to deploy the war, it doesn't respect the path
> attribute of the war. i.e my war is by the name
> mywar-R10-SNAPSHOT.war, so the context is set as mywar-R10-SNAPSHOT rather
> than just mywar.
As expected. Read the docs for the Context element.
> 2. How can I confirm if clearReferencesStopThread and
> clearReferencesThreadLocals attributes are being respected or not??
If they do anything, there will be a message in the log on context stop.
However, you are using 6.0.18 (current 6.0.x version is 6.0.32 and there
is also 7.0.11) and I don't believe those options are available in 6.0.18.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Advantages of using tomcat manager over the conventional approach
of copy-it-to-deploy/undeploy
Posted by neeraj kumar <ne...@gmail.com>.
Hi Mark,
I have a multiwar app.
I made the changes to one war in myway/META-INF/context.xml
<Context path="/mywar" clearReferencesStopThreads="true"
clearReferencesThreadLocals="true">
</Context>
The issue is:
1.When I use tomcat manager to deploy the war, it doesn't respect the path
attribute of the war. i.e my war is by the name
mywar-R10-SNAPSHOT.war, so the context is set as mywar-R10-SNAPSHOT rather
than just mywar.
2. How can I confirm if clearReferencesStopThread and
clearReferencesThreadLocals attributes are being respected or not??
Thanks
--
Neeraj
On Tue, Mar 22, 2011 at 8:38 PM, Mark Thomas <ma...@apache.org> wrote:
> On 22/03/2011 14:42, neeraj kumar wrote:
> > Hi ,
> >
> > I am using Tomcat 6.0.18 , JVM Version 1.6.0_24 ,OS SunOS 5.10, OSArch
> > :AMD64
> >
> > Recently I observed in few apps deployed on tomcat, that when I undeploy
> the
> > apps by simply deleting the .war file and the directory for the app, a
> few
> > threads are not cleaned up.
> >
> > I would be happy if someone shed some light on the following:
> >
> > 1, Is there a way of a full clean undeployment of a webapp ?
>
> No. There is no safe mechanism to stop an application created thread.
> There are some very dirty hacks you can use but they are very unstable.
> See clearReferencesStopThreads in
> http://tomcat.apache.org/tomcat-7.0-doc/config/context.html
>
> In testing I managed to crash the JVM about 50% of the time with that
> option enabled.
>
> By far the best way to fix this issue is for the application to stop any
> threads it starts using a ServletContextListener. I view failure to do
> so as a serious application bug since is triggers a heap of issues
> including PermGen memory leaks.
>
> > 2. Does tomcat manager help the developer/administrator in a full cleanup
> of
> > an app during undeployment , or even the manager simply deletes the war
> and
> > lets the tomcat container take care of undeploying??
>
> The Manager adds a little logic to prevent some race conditions that may
> occur if you just delete the file. It is marginally safer but there is
> no extra clean-up performed.
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Advantages of using tomcat manager over the conventional approach
of copy-it-to-deploy/undeploy
Posted by Francis GALIEGUE <fg...@one2team.com>.
On Thu, Mar 24, 2011 at 08:06, neeraj kumar <ne...@gmail.com> wrote:
> Mark,
>
> Thanks a lot for the reply.
>
> This was really helpful.
>
> Thanks
>
I find there is a very nice feature with the manager webapp: if you
use it in text mode and ask it to deploy/start/stop/undeploy an
application, the command you issue will terminate only when it is
finished (either well or badly). In short, it is ideally suited for
scripting purposes.
--
Francis Galiegue
ONE2TEAM
Ingénieur système
Mob : +33 (0) 683 877 875
Tel : +33 (0) 178 945 552
fge@one2team.com
40 avenue Raymond Poincaré
75116 Paris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Advantages of using tomcat manager over the conventional approach
of copy-it-to-deploy/undeploy
Posted by neeraj kumar <ne...@gmail.com>.
Mark,
Thanks a lot for the reply.
This was really helpful.
Thanks
--
Neeraj
On Tue, Mar 22, 2011 at 8:38 PM, Mark Thomas <ma...@apache.org> wrote:
> On 22/03/2011 14:42, neeraj kumar wrote:
> > Hi ,
> >
> > I am using Tomcat 6.0.18 , JVM Version 1.6.0_24 ,OS SunOS 5.10, OSArch
> > :AMD64
> >
> > Recently I observed in few apps deployed on tomcat, that when I undeploy
> the
> > apps by simply deleting the .war file and the directory for the app, a
> few
> > threads are not cleaned up.
> >
> > I would be happy if someone shed some light on the following:
> >
> > 1, Is there a way of a full clean undeployment of a webapp ?
>
> No. There is no safe mechanism to stop an application created thread.
> There are some very dirty hacks you can use but they are very unstable.
> See clearReferencesStopThreads in
> http://tomcat.apache.org/tomcat-7.0-doc/config/context.html
>
> In testing I managed to crash the JVM about 50% of the time with that
> option enabled.
>
> By far the best way to fix this issue is for the application to stop any
> threads it starts using a ServletContextListener. I view failure to do
> so as a serious application bug since is triggers a heap of issues
> including PermGen memory leaks.
>
> > 2. Does tomcat manager help the developer/administrator in a full cleanup
> of
> > an app during undeployment , or even the manager simply deletes the war
> and
> > lets the tomcat container take care of undeploying??
>
> The Manager adds a little logic to prevent some race conditions that may
> occur if you just delete the file. It is marginally safer but there is
> no extra clean-up performed.
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Advantages of using tomcat manager over the conventional approach
of copy-it-to-deploy/undeploy
Posted by Mark Thomas <ma...@apache.org>.
On 22/03/2011 14:42, neeraj kumar wrote:
> Hi ,
>
> I am using Tomcat 6.0.18 , JVM Version 1.6.0_24 ,OS SunOS 5.10, OSArch
> :AMD64
>
> Recently I observed in few apps deployed on tomcat, that when I undeploy the
> apps by simply deleting the .war file and the directory for the app, a few
> threads are not cleaned up.
>
> I would be happy if someone shed some light on the following:
>
> 1, Is there a way of a full clean undeployment of a webapp ?
No. There is no safe mechanism to stop an application created thread.
There are some very dirty hacks you can use but they are very unstable.
See clearReferencesStopThreads in
http://tomcat.apache.org/tomcat-7.0-doc/config/context.html
In testing I managed to crash the JVM about 50% of the time with that
option enabled.
By far the best way to fix this issue is for the application to stop any
threads it starts using a ServletContextListener. I view failure to do
so as a serious application bug since is triggers a heap of issues
including PermGen memory leaks.
> 2. Does tomcat manager help the developer/administrator in a full cleanup of
> an app during undeployment , or even the manager simply deletes the war and
> lets the tomcat container take care of undeploying??
The Manager adds a little logic to prevent some race conditions that may
occur if you just delete the file. It is marginally safer but there is
no extra clean-up performed.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org