You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Seth Newton <sn...@keithley.com> on 2003/09/12 22:57:45 UTC

Memory Leak with static content

All,

OS: Sparc-Solaris 9
JDK: 1.4.0_02
Tomcat: 4.1.27

Problem:
I start tomcat and it takes up about 45MB of RAM.  I wrote a script to email me every ten minutes the amount of memory it's taking up.  The results are showing me that it gains about 1MB every 10 minutes or so (on average).  If I let it go, it will grow until it runs out of memory.  Right now, I have a script to restart tomcat after the memory is too high.  This is a bad solution.  I've looked at a LOT of people's suggestions from other threads, and I have tried the following:

-Use jikes
-Set development to false in web.xml
-Increase the heap sizes 
-set fork to true in web.xml

Other Info:
-I'm using Tomcat to feed about 6 sites with static content.  I have one jsp page that handles all of our forms, and all that does is capture the <input> and send it to an email address.  It is the only code I have anywhere.  This jsp page is not causing the memory leak.
-I had the same problem with 4.1.17, and was hoping that an update would help, but it didn't.
-This is an incremental increase, and doesn't seem to have much to do with traffic patterns or how much I use my one jsp page.

Any suggestions would be great.
-Seth.

Re: Memory Leak with static content

Posted by Anton Tagunov <at...@mail.cnt.ru>.
Hello Seth!

SN> All,

SN> OS: Sparc-Solaris 9
SN> JDK: 1.4.0_02
SN> Tomcat: 4.1.27

SN> Problem:
SN> I start tomcat and it takes up about 45MB of RAM.  I wrote a script to email me every ten minutes the amount of memory it's taking up.  The results are showing me that it gains about 1MB every 10
SN> minutes or so (on average).  If I let it go, it will grow until it runs out of memory.

You really get an OutOfMemoryException?

I would expect that memory consumption would grow and grow
untill it reaches something near the allowed maximum and then
garbage collection would break in and free some of already
allocated memory. (Of couse it won't give it back to the OS,
but it will be free for processing further requests by Tomcat
itself)

In other words I would expect that memory
consumption would stabilize somewhere near the allowed maximum.

Does this happen? Or do Tomcat threads really die with an
OutOfMemoryException?

Anton


Re: Memory Leak with static content

Posted by James Harman <ha...@comcast.net>.
Seth,

As you mentioned taht the jsp page is not the problem I hope that you 
have looked to make sure that you are closing off any input/ouput 
streams and other resources involved in sending the email right?

James

Seth Newton wrote:

>-I'm using Tomcat to feed about 6 sites with static content.  I have one jsp page that handles all of our forms, and all that does is capture the <input> and send it to an email address.  It is the only code I have anywhere.  This jsp page is not causing the memory leak.
>
>  
>


Re: Memory Leak with static content

Posted by Paul <pa...@msci.ca>.
   you sure it is not the operating system itself.

----- Original Message ----- 
From: "Seth Newton" <sn...@keithley.com>
To: <to...@jakarta.apache.org>
Sent: Friday, September 12, 2003 4:57 PM
Subject: Memory Leak with static content


All,

OS: Sparc-Solaris 9
JDK: 1.4.0_02
Tomcat: 4.1.27

Problem:
I start tomcat and it takes up about 45MB of RAM.  I wrote a script to email
me every ten minutes the amount of memory it's taking up.  The results are
showing me that it gains about 1MB every 10 minutes or so (on average).  If
I let it go, it will grow until it runs out of memory.  Right now, I have a
script to restart tomcat after the memory is too high.  This is a bad
solution.  I've looked at a LOT of people's suggestions from other threads,
and I have tried the following:

-Use jikes
-Set development to false in web.xml
-Increase the heap sizes
-set fork to true in web.xml

Other Info:
-I'm using Tomcat to feed about 6 sites with static content.  I have one jsp
page that handles all of our forms, and all that does is capture the <input>
and send it to an email address.  It is the only code I have anywhere.  This
jsp page is not causing the memory leak.
-I had the same problem with 4.1.17, and was hoping that an update would
help, but it didn't.
-This is an incremental increase, and doesn't seem to have much to do with
traffic patterns or how much I use my one jsp page.

Any suggestions would be great.
-Seth.



Re: Memory Leak with static content

Posted by Seth Newton <sn...@keithley.com>.
All,

Updates to this issue....

-I'm not sure if it's the OS, but I've never seen this happen before on
other Solaris installs.  What would I look at to determine if it's the OS?..
The way that question is phrased makes it difficult for me to completely
understand what you mean. Can you be more specific?
-It did take up memory until Tomcat would no longer serve pages.  Users
would try to see their sites and just get a blank white screen until their
request timed out.  I haven't let it time go incrementally since I've
upgraded Tomcat or the jdk, however, I may let it stall out if I get that
desperate.
-I upgraded to 1.4.2 and still the memory increases.
-Yes, I'm closing all streams in the email class.  Also, this particular
code has been used successfully across platforms and across java servers for
about 3 years now.

Anymore input is greatly appreciated.

-Seth.
----- Original Message ----- 
From: "Nikolaos Giannopoulos" <ni...@solmar.ca>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Friday, September 12, 2003 6:04 PM
Subject: RE: Memory Leak with static content


> Seth,
>
> Have you tried JDK 1.4.2?  1.4.0 has been known to have a memory leak in
the
> StringBuffer implementation w.r.t. re-using StringBuffers but you mention
> that your only serving static content so this may not be it.
>
> However, I believe that I read that something like 2000 bugs have been
fixed
> in 1.4.2 (if my memory serves me well).  We have have no visible problems
> running tomcat 4.1.12/18 stand alone w/ 1.4.2 on Solaris 8 on 4 boxes (no
> JSPs - just servlets and static content).
>
> Please reply back if this works or does not work for you - we are looking
at
> upgrading our Tomcat instances in the near future.
>
> HTH.
>
> --Nikolaos
>
>
> > -----Original Message-----
> > From: Seth Newton [mailto:snewton@keithley.com]
> > Sent: Friday, September 12, 2003 4:58 PM
> > To: tomcat-user@jakarta.apache.org
> > Subject: Memory Leak with static content
> >
> >
> > All,
> >
> > OS: Sparc-Solaris 9
> > JDK: 1.4.0_02
> > Tomcat: 4.1.27
> >
> > Problem:
> > I start tomcat and it takes up about 45MB of RAM.  I wrote a
> > script to email me every ten minutes the amount of memory it's
> > taking up.  The results are showing me that it gains about 1MB
> > every 10 minutes or so (on average).  If I let it go, it will
> > grow until it runs out of memory.  Right now, I have a script to
> > restart tomcat after the memory is too high.  This is a bad
> > solution.  I've looked at a LOT of people's suggestions from
> > other threads, and I have tried the following:
> >
> > -Use jikes
> > -Set development to false in web.xml
> > -Increase the heap sizes
> > -set fork to true in web.xml
> >
> > Other Info:
> > -I'm using Tomcat to feed about 6 sites with static content.  I
> > have one jsp page that handles all of our forms, and all that
> > does is capture the <input> and send it to an email address.  It
> > is the only code I have anywhere.  This jsp page is not causing
> > the memory leak.
> > -I had the same problem with 4.1.17, and was hoping that an
> > update would help, but it didn't.
> > -This is an incremental increase, and doesn't seem to have much
> > to do with traffic patterns or how much I use my one jsp page.
> >
> > Any suggestions would be great.
> > -Seth.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>


RE: Memory Leak with static content

Posted by Nikolaos Giannopoulos <ni...@solmar.ca>.
Seth,

Have you tried JDK 1.4.2?  1.4.0 has been known to have a memory leak in the
StringBuffer implementation w.r.t. re-using StringBuffers but you mention
that your only serving static content so this may not be it.

However, I believe that I read that something like 2000 bugs have been fixed
in 1.4.2 (if my memory serves me well).  We have have no visible problems
running tomcat 4.1.12/18 stand alone w/ 1.4.2 on Solaris 8 on 4 boxes (no
JSPs - just servlets and static content).

Please reply back if this works or does not work for you - we are looking at
upgrading our Tomcat instances in the near future.

HTH.

--Nikolaos


> -----Original Message-----
> From: Seth Newton [mailto:snewton@keithley.com]
> Sent: Friday, September 12, 2003 4:58 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Memory Leak with static content
>
>
> All,
>
> OS: Sparc-Solaris 9
> JDK: 1.4.0_02
> Tomcat: 4.1.27
>
> Problem:
> I start tomcat and it takes up about 45MB of RAM.  I wrote a
> script to email me every ten minutes the amount of memory it's
> taking up.  The results are showing me that it gains about 1MB
> every 10 minutes or so (on average).  If I let it go, it will
> grow until it runs out of memory.  Right now, I have a script to
> restart tomcat after the memory is too high.  This is a bad
> solution.  I've looked at a LOT of people's suggestions from
> other threads, and I have tried the following:
>
> -Use jikes
> -Set development to false in web.xml
> -Increase the heap sizes
> -set fork to true in web.xml
>
> Other Info:
> -I'm using Tomcat to feed about 6 sites with static content.  I
> have one jsp page that handles all of our forms, and all that
> does is capture the <input> and send it to an email address.  It
> is the only code I have anywhere.  This jsp page is not causing
> the memory leak.
> -I had the same problem with 4.1.17, and was hoping that an
> update would help, but it didn't.
> -This is an incremental increase, and doesn't seem to have much
> to do with traffic patterns or how much I use my one jsp page.
>
> Any suggestions would be great.
> -Seth.