You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andrievsky Dmaitry <di...@teztour.com> on 2005/12/19 09:58:46 UTC
About possible memory leak in Tomcat 5.x
Hello users,
About a half a year ago I've found that my webapp works fine in
development environment, but leaks memory in production one.
I've searched through all the code, found a few minor errors, but it
didn't help.
(of course, tag pooling are disabled completely)
So then i've tried to use profiler, looking on alien classes.
(I've tried before too, but my attention was concentrated on my own classes)
And then i've found lots of
org.apache.jasper.runtime.PageContextImpl
from which there were a lot of references to the objects, that i've
treated as dead.
All PageContextImpl's lived at
org.apache.jasper.runtime.JspFactoryImpl.pool
There are property of org.apache.jasper.runtime.JspFactoryImpl, named
USE_POOL, which rules pool usage, but it is private,
and i've not found any way to set it to "false" from outside.
Initially it's "true".
So, i've set it to "false" directly in code,
rebuilt tomcat and replaced files ${CATALINA_HOME}/common/lib/jasper-*.jar
from production environment with fresh ones.
So, it seems that the problem is successfully solved.
As far as I can see there no more memory leakage.
I think it would be useful to allow users to set property of
org.apache.jasper.runtime.JspFactoryImpl.USE_POOL from config files or
in any other way, without rebuilding entire tomcat application.
P.S.
In fact, I think, it's not REAL memory leak - memory usage, may be,
will stop grow on some large value (2+ GB, when pool become full), but i have not such
amount of memory.
Now memory usage about 100-200 mb after full gc, depending on amount
of currently working users.
P.P.S What seems to me interesting.
Although before putting PageContextImpl into pool JspFactoryImpl calls
pc.release(), and inside the method all links must become null (or
not?..) and referenced objects must become available to gc, they are not.
May be it is the root of the problem?..
BTW disabling of pool solves the problem completely...
--
Best regards,
Dmitry Andrievsky mailto:dimmik@teztour.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re[2]: About possible memory leak in Tomcat 5.x
Posted by Àíäðèåâñêèé Äìèòðèé <di...@teztour.com>.
Hello Anoop,
> I hope you will have the tomcat developers look into this by sending this to
> tomcat-developers forum.
I did, and they have already fixed it up in one of recent svn (is it
the same as cvs?..) commit.
May be not because of my letter, though :)
20.dec.05:
subject: svn commit: r358036 - in /tomcat/jasper/tc5.5.x/jasper2/src/share/org/apache/jasper/runtime: BodyContentImpl.java JspFactoryImpl.java
> Modified: tomcat/jasper/tc5.5.x/jasper2/src/share/org/apache/jasper/runtime/JspFactoryImpl.java
> URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc5.5.x/jasper2/src/share/org/apache/jasper/runtime/JspFactoryImpl.java?rev=358036&r1=358035&r2=358036&view=diff
> ==============================================================================
> --- tomcat/jasper/tc5.5.x/jasper2/src/share/org/apache/jasper/runtime/JspFactoryImpl.java (original)
> +++ tomcat/jasper/tc5.5.x/jasper2/src/share/org/apache/jasper/runtime/JspFactoryImpl.java Tue Dec 20 09:02:33 2005
> @@ -40,9 +40,10 @@
> private Log log = LogFactory.getLog(JspFactoryImpl.class);
>
> private static final String SPEC_VERSION = "2.0";
> - private static final boolean USE_POOL = true;
> + private static final boolean USE_POOL =
> + Boolean.parseBoolean(System.getProperty("org.apache.jasper.runtime.JspFactoryImpl.USE_POOL", "true"));
Monday, December 26, 2005, 9:24:37 AM, you wrote:
> I think this is a great finding - it will certainly help all those teams
> faced with the Out of memory errors which curiously pops up oly after we
> move the code to production..
> I hope you will have the tomcat developers look into this by sending this to
> tomcat-developers forum.
> THanks,
> Anoop
> On 12/19/05, Andrievsky Dmaitry <di...@teztour.com> wrote:
>>
>> Hello users,
>>
>> About a half a year ago I've found that my webapp works fine in
>> development environment, but leaks memory in production one.
>> I've searched through all the code, found a few minor errors, but it
>> didn't help.
>> (of course, tag pooling are disabled completely)
>>
>> So then i've tried to use profiler, looking on alien classes.
>> (I've tried before too, but my attention was concentrated on my own
>> classes)
>>
>> And then i've found lots of
>> org.apache.jasper.runtime.PageContextImpl
>> from which there were a lot of references to the objects, that i've
>> treated as dead.
>>
>>
>> All PageContextImpl's lived at
>> org.apache.jasper.runtime.JspFactoryImpl.pool
>>
>>
>> There are property of org.apache.jasper.runtime.JspFactoryImpl, named
>> USE_POOL, which rules pool usage, but it is private,
>> and i've not found any way to set it to "false" from outside.
>> Initially it's "true".
>>
>> So, i've set it to "false" directly in code,
>> rebuilt tomcat and replaced files
>> ${CATALINA_HOME}/common/lib/jasper-*.jar
>> from production environment with fresh ones.
>>
>> So, it seems that the problem is successfully solved.
>> As far as I can see there no more memory leakage.
>>
>> I think it would be useful to allow users to set property of
>> org.apache.jasper.runtime.JspFactoryImpl.USE_POOL from config files or
>> in any other way, without rebuilding entire tomcat application.
>>
>> P.S.
>> In fact, I think, it's not REAL memory leak - memory usage, may be,
>> will stop grow on some large value (2+ GB, when pool become full), but i
>> have not such
>> amount of memory.
>> Now memory usage about 100-200 mb after full gc, depending on amount
>> of currently working users.
>>
>> P.P.S What seems to me interesting.
>> Although before putting PageContextImpl into pool JspFactoryImpl calls
>> pc.release(), and inside the method all links must become null (or
>> not?..) and referenced objects must become available to gc, they are not.
>> May be it is the root of the problem?..
>>
>> BTW disabling of pool solves the problem completely...
>>
>>
>> --
>> Best regards,
>> Dmitry Andrievsky mailto:dimmik@teztour.com
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> --
> Thanks and best regards,
> Anoop
--
Best regards,
Äìèòðèé Àíäðèåâñêèé mailto:dimmik@teztour.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: About possible memory leak in Tomcat 5.x
Posted by Anoop kumar V <an...@gmail.com>.
I think this is a great finding - it will certainly help all those teams
faced with the Out of memory errors which curiously pops up oly after we
move the code to production..
I hope you will have the tomcat developers look into this by sending this to
tomcat-developers forum.
THanks,
Anoop
On 12/19/05, Andrievsky Dmaitry <di...@teztour.com> wrote:
>
> Hello users,
>
> About a half a year ago I've found that my webapp works fine in
> development environment, but leaks memory in production one.
> I've searched through all the code, found a few minor errors, but it
> didn't help.
> (of course, tag pooling are disabled completely)
>
> So then i've tried to use profiler, looking on alien classes.
> (I've tried before too, but my attention was concentrated on my own
> classes)
>
> And then i've found lots of
> org.apache.jasper.runtime.PageContextImpl
> from which there were a lot of references to the objects, that i've
> treated as dead.
>
>
> All PageContextImpl's lived at
> org.apache.jasper.runtime.JspFactoryImpl.pool
>
>
> There are property of org.apache.jasper.runtime.JspFactoryImpl, named
> USE_POOL, which rules pool usage, but it is private,
> and i've not found any way to set it to "false" from outside.
> Initially it's "true".
>
> So, i've set it to "false" directly in code,
> rebuilt tomcat and replaced files ${CATALINA_HOME}/common/lib/jasper-*.jar
> from production environment with fresh ones.
>
> So, it seems that the problem is successfully solved.
> As far as I can see there no more memory leakage.
>
> I think it would be useful to allow users to set property of
> org.apache.jasper.runtime.JspFactoryImpl.USE_POOL from config files or
> in any other way, without rebuilding entire tomcat application.
>
> P.S.
> In fact, I think, it's not REAL memory leak - memory usage, may be,
> will stop grow on some large value (2+ GB, when pool become full), but i
> have not such
> amount of memory.
> Now memory usage about 100-200 mb after full gc, depending on amount
> of currently working users.
>
> P.P.S What seems to me interesting.
> Although before putting PageContextImpl into pool JspFactoryImpl calls
> pc.release(), and inside the method all links must become null (or
> not?..) and referenced objects must become available to gc, they are not.
> May be it is the root of the problem?..
>
> BTW disabling of pool solves the problem completely...
>
>
> --
> Best regards,
> Dmitry Andrievsky mailto:dimmik@teztour.com
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
--
Thanks and best regards,
Anoop