You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Igor Mukhin <ii...@mail.ru> on 2009/09/30 16:25:38 UTC
6.0.20 - New behavior on conf/Catalina//.xml update.
Why redeploy?
Hallo everybody,
At first I like to say that I always loved Tomcat and the job the
commiters/community does with it. But this change/version is just
frustrating...
I tried Tomcat 6.0.20 yesterday and was really disappointed about what
happend (since 6.0.18) with the handing of context.xml. The change was
on a minor (bugfixing) version, but it makes Tomcat backward
uncompatible for many people. The new behavior (coping context.xml to
/conf, redeploy on update of /conf/.../<ctxpath>.xml) just replaces the
old behavior, without a option the have the old one back.
1.
I have looked at the new documentation and the new code in
org.apache.catalina.startup.HostConfig.java. And my first question is:
what is reason behind redeploying the application after detecting an
update of /conf/.../<ctxpath>.xml? (6.0.18 restarts the application in
this case)
Just think about it: You have an tomcat production server with 200
applications. All application were deployed statically and they (and
you) have no .war files. You can't restart the tomcat. But you need to
update the database resource parameter in /conf/.../<ctxpath>.xml of an
application promtly. You edit the file, save it. In a minute a customer
calls you on the phone and tells the application is not accessible. You
look into appBase, but the app is not there. Tomcat has deleted it (in a
try to redeply, but there is not .war file to deploy) ?!?! Where are my
files?!?!?
2.
If I deliver a patch that makes the behavoir after updating a
/conf/.../<ctxpath>.xml configurable, could it be included in the next
version?
Something like <Context ...
onDetectContextXmlUpdate="redeploy|reload|ignore"> where "redeploy" is
default to keep new behavior
3.
If I deliver a patch that optionally turns off copying
/META-INF/context.xml to /conf/.../<ctxpath>.xml, could it be included
in the next version?
Something like <Host ... copyFirstApplicationContextXml="true|false">,
where "true" is default to keep new behavior
Thanks
Igor
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: 6.0.20 - New behavior on conf/Catalina//.xml
update. Why redeploy?
Posted by Peter Crowther <pe...@melandra.com>.
2009/10/1 Mark Thomas <ma...@apache.org>
> > 2009/9/30 Peter Crowther <pe...@melandra.com>:
> >> I wonder whether this is a race condition with some text editors. For
> >> example, if vi operated in the following way:
> >> 1) Rename context.xml to context.xml~
> >> 2) Create context.xml, write contents, close file
> >> ... then a poll of the state of context.xml between 1 and 2 would show
> >> context.xml as missing.
> >
> > A swift perusal of the vim/gvim sources indicates that at least those
> > two editors operate in exactly this way. There's a small period when
> > the file would appear not to be present if polled.
>
> That could explain what Igor saw although the odds of it happening must
> be pretty small. Could you raise a bug for this in Bugzilla? For the fix
> I'm thinking along the lines of waiting 500ms if the file appears to be
> deleted to check that it doesn't re-appear before continuing.
>
https://issues.apache.org/bugzilla/show_bug.cgi?id=48009
- Peter
Re: 6.0.20 - New behavior on conf/Catalina//.xml
update. Why redeploy?
Posted by Mark Thomas <ma...@apache.org>.
Peter Crowther wrote:
> 2009/10/1 Mark Thomas <ma...@apache.org>:
>> Peter Crowther wrote:
>>> I wonder whether this is a race condition with some text editors. For
>>> example, if vi operated in the following way:
>>> 1) Rename context.xml to context.xml~
>>> 2) Create context.xml, write contents, close file
>>> ... then a poll of the state of context.xml between 1 and 2 would show
>>> context.xml as missing.
>>>
>>> A swift perusal of the vim/gvim sources indicates that at least those
>>> two editors operate in exactly this way. There's a small period when
>>> the file would appear not to be present if polled.
>> That could explain what Igor saw although the odds of it happening must
>> be pretty small. Could you raise a bug for this in Bugzilla? For the fix
>> I'm thinking along the lines of waiting 500ms if the file appears to be
>> deleted to check that it doesn't re-appear before continuing.
>
> The odds would increase on a heavily loaded system, but I agree it's
> pretty unlikely.
>
> On the flip side, most people would only notice it if, like Igor, they
> didn't have the war file and had autoDeploy set to "true". In any
> other situation this would cause a re-deploy rather than a re-load,
> but the system would recover to its previous state. So it might be
> more common than we know!
The WAR file would be deleted as well.
> I'll create a Bugzilla entry once Bugzilla responds - at present it's
> timing out on 3 page loads in 4.
Thanks. There has been a DDOS against the server that runs Bugzilla for the last
few days. infra is doing what it can to mitigate the effects.
> My own suggested fix would have been
> to delete only if two successive polls indicated that the file had
> been deleted, but you know the source code far better than I do.
I was going for the easy option :) - depending on the the detail of the current
implementation, your approach could be just as simple - I'll take a look.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: 6.0.20 - New behavior on conf/Catalina//.xml
update. Why redeploy?
Posted by Peter Crowther <pe...@melandra.com>.
2009/10/1 Mark Thomas <ma...@apache.org>:
> Peter Crowther wrote:
>> I wonder whether this is a race condition with some text editors. For
>> example, if vi operated in the following way:
>> 1) Rename context.xml to context.xml~
>> 2) Create context.xml, write contents, close file
>> ... then a poll of the state of context.xml between 1 and 2 would show
>> context.xml as missing.
>>
>> A swift perusal of the vim/gvim sources indicates that at least those
>> two editors operate in exactly this way. There's a small period when
>> the file would appear not to be present if polled.
>
> That could explain what Igor saw although the odds of it happening must
> be pretty small. Could you raise a bug for this in Bugzilla? For the fix
> I'm thinking along the lines of waiting 500ms if the file appears to be
> deleted to check that it doesn't re-appear before continuing.
The odds would increase on a heavily loaded system, but I agree it's
pretty unlikely.
On the flip side, most people would only notice it if, like Igor, they
didn't have the war file and had autoDeploy set to "true". In any
other situation this would cause a re-deploy rather than a re-load,
but the system would recover to its previous state. So it might be
more common than we know!
I'll create a Bugzilla entry once Bugzilla responds - at present it's
timing out on 3 page loads in 4. My own suggested fix would have been
to delete only if two successive polls indicated that the file had
been deleted, but you know the source code far better than I do.
- Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: 6.0.20 - New behavior on conf/Catalina//.xml
update. Why redeploy?
Posted by Mark Thomas <ma...@apache.org>.
Peter Crowther wrote:
> I know it's bad form to reply to my original mail - sorry!
>
> 2009/9/30 Peter Crowther <pe...@melandra.com>:
>> I wonder whether this is a race condition with some text editors. For
>> example, if vi operated in the following way:
>> 1) Rename context.xml to context.xml~
>> 2) Create context.xml, write contents, close file
>> ... then a poll of the state of context.xml between 1 and 2 would show
>> context.xml as missing.
>
> A swift perusal of the vim/gvim sources indicates that at least those
> two editors operate in exactly this way. There's a small period when
> the file would appear not to be present if polled.
That could explain what Igor saw although the odds of it happening must
be pretty small. Could you raise a bug for this in Bugzilla? For the fix
I'm thinking along the lines of waiting 500ms if the file appears to be
deleted to check that it doesn't re-appear before continuing.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: 6.0.20 - New behavior on conf/Catalina//.xml
update. Why redeploy?
Posted by Peter Crowther <pe...@melandra.com>.
I know it's bad form to reply to my original mail - sorry!
2009/9/30 Peter Crowther <pe...@melandra.com>:
> I wonder whether this is a race condition with some text editors. For
> example, if vi operated in the following way:
> 1) Rename context.xml to context.xml~
> 2) Create context.xml, write contents, close file
> ... then a poll of the state of context.xml between 1 and 2 would show
> context.xml as missing.
A swift perusal of the vim/gvim sources indicates that at least those
two editors operate in exactly this way. There's a small period when
the file would appear not to be present if polled.
- Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: 6.0.20 - New behavior on conf/Catalina//.xml
update. Why redeploy?
Posted by Peter Crowther <pe...@melandra.com>.
2009/9/30 Mark Thomas <ma...@apache.org>:
> I can't reproduce with my mac either which makes me think the context.xml file
> was missing (renamed, deleted, moved) at the moment the autoDeploy thread looked
> for it and that triggered an undeploy and associated deletion of the directory.
I wonder whether this is a race condition with some text editors. For
example, if vi operated in the following way:
1) Rename context.xml to context.xml~
2) Create context.xml, write contents, close file
... then a poll of the state of context.xml between 1 and 2 would show
context.xml as missing.
If so, this is a potentially dangerous race!
- Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: 6.0.20 - New behavior on conf/Catalina//.xml update.
Why redeploy?
Posted by Igor Mukhin <ii...@mail.ru>.
I just tried to reproduce the issue on the server from yesterday. The
application is reloaded just fine. No deletions/undeployments.
I love Tomcat again.
Thanks, Mark.
P.S. But just to be consistent, why not to create an empty context xml
file under /conf/Catalina for applications that have no
/META-INF/context.xml file?
Regards
Igor
Mark Thomas wrote:
> Igor Mukhin wrote:
>
>> Thanks, Mark.
>>
>> 1. I just tried to reproduce the issue on my pc. And I couldn't, which
>> is a good thing. I will try it again later on the server, with which I
>> had the issue yesterday.
>>
> I can't reproduce with my mac either which makes me think the context.xml file
> was missing (renamed, deleted, moved) at the moment the autoDeploy thread looked
> for it and that triggered an undeploy and associated deletion of the directory.
>
>
>> 2. OK
>> 3. Can live with that
>>
>
> Great.
>
> For the record the only change in this area that should have happened between
> 6.0.18 and 6.0.20 was that in 6.0.18 context.xml files were copied from WAR
> files only whereas in 6.0.20 they are copied from directories and WAR files.
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
Re: 6.0.20 - New behavior on conf/Catalina//.xml update.
Why redeploy?
Posted by Uwe Günther <uw...@cscc.de>.
Igor Mukhin wrote:
> I just tried to reproduce the issue on the server from yesterday. The
> application is reloaded just fine. No deletions/undeployments.
>
> I love Tomcat again.
> Thanks, Mark.
Igor, I had a look in the code as well in the past week because of some
issues in the manager webapp. A save workarround could be useing the JMX
interface of HostConfig.java:
1.) Start up Tomcat with CATALINA_OPTS=-Dcom.sun.management.jmxremote
2.) Startup Suns jconsole on the same box and connect to your Tomcat
process. There are some remote RMI ways as well to connect from a remote
location.
3.) Go to the MBeans tab of jconsole
4.) Unfold Catalina|Deployer|<Hostname>|Operations
5.) Select "addServiced" and type in the textfield for the method
parameter on the right panel the context path name of your webapp, e.g.
'/myWebapp' and press the 'addService' button.
6.) Select "unmanageApp" and type in the textfield for the method
parameter on the right panel the context path name of your webapp, e.g.
'/myWebapp' and press the 'unmanageApp' button.
7.) Now do whatever you want with your webapp '/myWebapp', because
HostConfig.java would not touch it anymore. It leaves it alone from now
on. For example you can change the the configuration artifacts.
8.) Select "check" and on the right panel type in the textfield for the
method parameter the context path name of your webapp, e.g. '/myWebapp'
and press the 'check' button. This will kick of the deployment of your
webapp '/myWebapp' after you have fixed your config for example.
9.) Select "removeServiced" and type in the textfield for the method
parameter on the right panel the context path name of your webapp, e.g.
'/myWebapp' and press the 'removeServiced' button. This brings
HostConfig.java back in the game and your webapp will be periodicaly
checked like before step 5.)
10.) With the 'isServiced' operation you could check if you removed it
correctly from the serviced hashmap. In case HostConfig takes care of it
it should return false.
'Serviced' is here more from your point of view. I understand it as some
body else takes care of this webapp, not HostConfig.java
I know this is not that easy, but I just outline a save way for
production to modify the webapp configuration artifact if something does
not work as expected.
--
Kind Regards
Uwe Günther
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: 6.0.20 - New behavior on conf/Catalina//.xml update.
Why redeploy?
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Igor,
On 9/30/2009 12:11 PM, Igor Mukhin wrote:
> P.S. But just to be consistent, why not to create an empty context xml
> file under /conf/Catalina for applications that have no
> /META-INF/context.xml file?
You are essentially talking about conf/context.xml, which sets defaults
for webapps.
Or, were you saying that such a file should be copied during deployment
of a context.xml-less webapp.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkrE0LwACgkQ9CaO5/Lv0PC10QCfVhBHgAUimeRnRzz61Hz6Nbo1
qAUAnjv7R08ypBtN1xm+18ZcAAwbIh0Q
=a5lu
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: 6.0.20 - New behavior on conf/Catalina//.xml update.
Why redeploy?
Posted by Igor Mukhin <ii...@mail.ru>.
I just tried to reproduce the issue on the server from yesterday. The
application is reloaded just fine. No deletions/undeployments.
I love Tomcat again.
Thanks, Mark.
P.S. But just to be consistent, why not to create an empty context xml
file under /conf/Catalina for applications that have no
/META-INF/context.xml file?
Regards
Igor
Mark Thomas wrote:
> Igor Mukhin wrote:
>
>> Thanks, Mark.
>>
>> 1. I just tried to reproduce the issue on my pc. And I couldn't, which
>> is a good thing. I will try it again later on the server, with which I
>> had the issue yesterday.
>>
> I can't reproduce with my mac either which makes me think the context.xml file
> was missing (renamed, deleted, moved) at the moment the autoDeploy thread looked
> for it and that triggered an undeploy and associated deletion of the directory.
>
>
>> 2. OK
>> 3. Can live with that
>>
>
> Great.
>
> For the record the only change in this area that should have happened between
> 6.0.18 and 6.0.20 was that in 6.0.18 context.xml files were copied from WAR
> files only whereas in 6.0.20 they are copied from directories and WAR files.
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: 6.0.20 - New behavior on conf/Catalina//.xml update.
Why redeploy?
Posted by Mark Thomas <ma...@apache.org>.
Igor Mukhin wrote:
> Thanks, Mark.
>
> 1. I just tried to reproduce the issue on my pc. And I couldn't, which
> is a good thing. I will try it again later on the server, with which I
> had the issue yesterday.
I can't reproduce with my mac either which makes me think the context.xml file
was missing (renamed, deleted, moved) at the moment the autoDeploy thread looked
for it and that triggered an undeploy and associated deletion of the directory.
> 2. OK
> 3. Can live with that
Great.
For the record the only change in this area that should have happened between
6.0.18 and 6.0.20 was that in 6.0.18 context.xml files were copied from WAR
files only whereas in 6.0.20 they are copied from directories and WAR files.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: 6.0.20 - New behavior on conf/Catalina//.xml update.
Why redeploy?
Posted by Igor Mukhin <ii...@mail.ru>.
Thanks, Mark.
1. I just tried to reproduce the issue on my pc. And I couldn't, which
is a good thing. I will try it again later on the server, with which I
had the issue yesterday.
2. OK
3. Can live with that
Mark Thomas wrote:
> Igor Mukhin wrote:
>
>> 1.
>> I have looked at the new documentation and the new code in
>> org.apache.catalina.startup.HostConfig.java. And my first question is:
>> what is reason behind redeploying the application after detecting an
>> update of /conf/.../<ctxpath>.xml? (6.0.18 restarts the application in
>> this case)
>>
>> Just think about it: You have an tomcat production server with 200
>> applications. All application were deployed statically and they (and
>> you) have no .war files. You can't restart the tomcat. But you need to
>> update the database resource parameter in /conf/.../<ctxpath>.xml of an
>> application promtly. You edit the file, save it. In a minute a customer
>> calls you on the phone and tells the application is not accessible. You
>> look into appBase, but the app is not there. Tomcat has deleted it (in a
>> try to redeply, but there is not .war file to deploy) ?!?! Where are my
>> files?!?!?
>>
>
> That sounds like a regression and a nasty one at that. Touching the context.xml
> file should trigger a reload not a redploy and then only if autoDeploy="true"
> for the host. I'm not in a position to test this right now. Are you sure the
> context.xml file was only updated?
>
> The only way an undeploy should be triggered is if the context.xml file is
> deleted (and autoDeploy="true"). This has always been the case.
>
>
>> 2.
>> If I deliver a patch that makes the behavoir after updating a
>> /conf/.../<ctxpath>.xml configurable, could it be included in the next
>> version?
>> Something like <Context ...
>> onDetectContextXmlUpdate="redeploy|reload|ignore"> where "redeploy" is
>> default to keep new behavior
>>
>
> No need. ignore is achieved by setting autoDeploy="false". undeploy is triggered
> if the context file is deleted and reload is triggered if the context file is
> updated. There is no way to trigger a (re)dploy. This wouldn't make much sense
> as a deployment needs a source and there is no obvious way of specifying one.
>
>
>> 3.
>> If I deliver a patch that optionally turns off copying
>> /META-INF/context.xml to /conf/.../<ctxpath>.xml, could it be included
>> in the next version?
>> Something like <Host ... copyFirstApplicationContextXml="true|false">,
>> where "true" is default to keep new behavior
>>
>
> Unlikely. The extraction of the context.xml file was a 6.0.x design decision. If
> the patch came with a convincing argument for the additional complexity then it
> would certainly get into 7.0.x and might get into 6.0.x and 5.5.x. That said,
> the tricky bit would be the convincing argument. I'd suggest trying to make your
> case before you spend time on the patch.
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
Re: 6.0.20 - New behavior on conf/Catalina//.xml update.
Why redeploy?
Posted by Mark Thomas <ma...@apache.org>.
Igor Mukhin wrote:
> 1.
> I have looked at the new documentation and the new code in
> org.apache.catalina.startup.HostConfig.java. And my first question is:
> what is reason behind redeploying the application after detecting an
> update of /conf/.../<ctxpath>.xml? (6.0.18 restarts the application in
> this case)
>
> Just think about it: You have an tomcat production server with 200
> applications. All application were deployed statically and they (and
> you) have no .war files. You can't restart the tomcat. But you need to
> update the database resource parameter in /conf/.../<ctxpath>.xml of an
> application promtly. You edit the file, save it. In a minute a customer
> calls you on the phone and tells the application is not accessible. You
> look into appBase, but the app is not there. Tomcat has deleted it (in a
> try to redeply, but there is not .war file to deploy) ?!?! Where are my
> files?!?!?
That sounds like a regression and a nasty one at that. Touching the context.xml
file should trigger a reload not a redploy and then only if autoDeploy="true"
for the host. I'm not in a position to test this right now. Are you sure the
context.xml file was only updated?
The only way an undeploy should be triggered is if the context.xml file is
deleted (and autoDeploy="true"). This has always been the case.
> 2.
> If I deliver a patch that makes the behavoir after updating a
> /conf/.../<ctxpath>.xml configurable, could it be included in the next
> version?
> Something like <Context ...
> onDetectContextXmlUpdate="redeploy|reload|ignore"> where "redeploy" is
> default to keep new behavior
No need. ignore is achieved by setting autoDeploy="false". undeploy is triggered
if the context file is deleted and reload is triggered if the context file is
updated. There is no way to trigger a (re)dploy. This wouldn't make much sense
as a deployment needs a source and there is no obvious way of specifying one.
> 3.
> If I deliver a patch that optionally turns off copying
> /META-INF/context.xml to /conf/.../<ctxpath>.xml, could it be included
> in the next version?
> Something like <Host ... copyFirstApplicationContextXml="true|false">,
> where "true" is default to keep new behavior
Unlikely. The extraction of the context.xml file was a 6.0.x design decision. If
the patch came with a convincing argument for the additional complexity then it
would certainly get into 7.0.x and might get into 6.0.x and 5.5.x. That said,
the tricky bit would be the convincing argument. I'd suggest trying to make your
case before you spend time on the patch.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org