Re: Placing JARs in ..../tomcat/shared/lib causes leaks when stopping apps?

2010-11-17 Thread Mark Shifman
On 11/17/2010 02:43 AM, Mikolaj Rydzewski wrote:
 
 On Tue, 16 Nov 2010 22:55:10 -0500, Brian bbprefix-m...@yahoo.com wrote:
 
 I have two identical apps running at the same time. I mean, they use exactly
 the same WAR, but each one runs in a different web domain.
 [...]
 
 You should rather change your application to be aware of domain it runs in.
 Done that, there would be only one webapp deployed - no matter how many 
 domains you need to handle.
 
Perhaps you could give Brian a hint on how to do this.  Would using aliases 
within the host do the trick?

mas



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Placing JARs in ..../tomcat/shared/lib causes leaks when stopping apps?

2010-11-17 Thread Brian
Hi Mikolaj and Mark,

Thanks for your help. I do know about aliases, but for some reason a couple of 
years ago I decided to keep each domain in a different context. And that reason 
was.hummm..like.. you know what? Either I forgot what the reason 
was (maybe because I have barely slept last night cause my website crashed), or 
there was no valid reason! 
As soon as I finish moving my JARs from the shared directory to the web-inf/lib 
directory and everything is OK, I will review that. Certaintly, if I don’t 
remember any valid reason to keep two contexts, I will start using just one!


 -Original Message-
 From: Mark Shifman [mailto:mark.shif...@yale.edu]
 Sent: Wednesday, November 17, 2010 08:30 AM
 To: Tomcat Users List
 Subject: Re: Placing JARs in /tomcat/shared/lib causes leaks when
 stopping apps?
 
 On 11/17/2010 02:43 AM, Mikolaj Rydzewski wrote:
 
  On Tue, 16 Nov 2010 22:55:10 -0500, Brian bbprefix-m...@yahoo.com
 wrote:
 
  I have two identical apps running at the same time. I mean, they use
  exactly the same WAR, but each one runs in a different web domain.
  [...]
 
  You should rather change your application to be aware of domain it runs in.
  Done that, there would be only one webapp deployed - no matter how
 many domains you need to handle.
 
 Perhaps you could give Brian a hint on how to do this.  Would using aliases
 within the host do the trick?
 
 mas
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Placing JARs in ..../tomcat/shared/lib causes leaks when stopping apps?

2010-11-17 Thread Caldarale, Charles R
 From: Brian [mailto:bbprefix-m...@yahoo.com] 
 Subject: RE: Placing JARs in /tomcat/shared/lib causes leaks when 
 stopping apps?

 if I don’t remember any valid reason to keep two contexts,
 I will start using just one!

One strong reason to not merge the contexts is to preclude any chance of 
mingling data between the two.  Don't know what your client requirements or 
expectations are, so that may or may not be a concern.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.



Placing JARs in ..../tomcat/shared/lib causes leaks when stopping apps?

2010-11-16 Thread Brian
Hi,

 

I'm using Tomcat 6.0.29.

 

I have two identical apps running at the same time. I mean, they use exactly
the same WAR, but each one runs in a different web domain. When I
stop/redeploy one of the apps, very often I get the famous leak problem,
because of the webclassloader not being able to get collected by the garbage
collector. etc etc etc.

 

I'm placing all my library JARs in a common directory
(../tomcat/shared/lib), and I set the catalina.properties file so Catalina
knows this directory exists. Why did I do that? For two reasons:

 

1- uploading a WAR without all the support JARs is faster than with them,
and I'm uploading my WARs very often, because I'm changing my app
constantly.

2- I THOUGHT/THINK that placing the JARs in the same shared directory is
better, because it takes less memory, and because after all there must be a
reason why the shared directory option existed by default (at least until
Tomcat 6.0.14 came out). And given that my two apps use exactly the same
WAR, it made sense to me to place the JARs in the shared dir.

 

Now I have read that this issue may be the reason of my problem with leaks.
Something like this for each app, the webapploader pretendes to unload all
the classes, and if they are shared it is not possible and then the leak
happens.

 

Is that true? Should I avoid using the shared lib directory? If so, for what
was this option created for?

 

Thanks,

 

Brian

 

 

 



RE: Placing JARs in ..../tomcat/shared/lib causes leaks when stopping apps?

2010-11-16 Thread Caldarale, Charles R
 From: Brian [mailto:bbprefix-m...@yahoo.com] 
 Subject: Placing JARs in /tomcat/shared/lib causes leaks when stopping 
 apps?

 Something like this for each app, the webapploader pretendes 
 to unload all the classes, and if they are shared it is not 
 possible and then the leak happens.

Well, the wording of the above is rather odd; there's no pretending going on, 
and nothing can unload a class directly - that's done only by GC after the 
class becomes unused.

 Is that true? 

Sort of.

 Should I avoid using the shared lib directory?

In almost all cases, yes.  It's safe to use the shared library when the classes 
placed therein truly are library functions (no persistent objects, no keeping 
of references to their callers), or when an object *must* be shared across 
multiple webapps.

 If so, for what was this option created for?

To allow /objects/ to be shared across webapps, in the rare instance that it's 
necessary.  Webapps are intended to be independent of one another, and any 
mingling of their content limits that independence severely - as you are 
observing.

Keep the webapps separate; it's a lot easier on everyone concerned.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Placing JARs in ..../tomcat/shared/lib causes leaks when stopping apps?

2010-11-16 Thread Brian
Thanks chuck, now I understand it. My JARs are the regular type of JAR, that
doesn't have to be shared by all the apps for some reason. I didn't
understand the real pourpose of that directory indeed. I will change it now.


 -Original Message-
 From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com]
 Sent: Tuesday, November 16, 2010 11:06 PM
 To: Tomcat Users List
 Subject: RE: Placing JARs in /tomcat/shared/lib causes leaks when
 stopping apps?
 
  From: Brian [mailto:bbprefix-m...@yahoo.com]
  Subject: Placing JARs in /tomcat/shared/lib causes leaks when
stopping
 apps?
 
  Something like this for each app, the webapploader pretendes to
  unload all the classes, and if they are shared it is not possible and
  then the leak happens.
 
 Well, the wording of the above is rather odd; there's no pretending going
on,
 and nothing can unload a class directly - that's done only by GC after the
class
 becomes unused.
 
  Is that true?
 
 Sort of.
 
  Should I avoid using the shared lib directory?
 
 In almost all cases, yes.  It's safe to use the shared library when the
classes
 placed therein truly are library functions (no persistent objects, no
keeping of
 references to their callers), or when an object *must* be shared across
 multiple webapps.
 
  If so, for what was this option created for?
 
 To allow /objects/ to be shared across webapps, in the rare instance that
it's
 necessary.  Webapps are intended to be independent of one another, and any
 mingling of their content limits that independence severely - as you are
 observing.
 
 Keep the webapps separate; it's a lot easier on everyone concerned.
 
  - Chuck
 
 
 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE
 PROPRIETARY MATERIAL and is thus for use only by the intended recipient.
If
 you received this in error, please contact the sender and delete the
e-mail and
 its attachments from all computers.
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Placing JARs in ..../tomcat/shared/lib causes leaks when stopping apps?

2010-11-16 Thread Mikolaj Rydzewski


On Tue, 16 Nov 2010 22:55:10 -0500, Brian bbprefix-m...@yahoo.com 
wrote:


I have two identical apps running at the same time. I mean, they use 
exactly

the same WAR, but each one runs in a different web domain.

[...]

You should rather change your application to be aware of domain it runs 
in.
Done that, there would be only one webapp deployed - no matter how many 
domains you need to handle.


--
Mikolaj Rydzewski m...@ceti.pl

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org