You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Reinhard Poetz <re...@apache.org> on 2005/05/28 09:50:02 UTC
Possible memory leak when handle-errors is called
I noticed that the memory consumption of my 2.2 applications (I haven't looked
into BRANCH_2.1.X yet) is steadily increasing. First I blamed the HTMLGenerator,
then I found out that the produced HTML contains a lot of img, script, link and
iframe tags. Those tags have in common that they lead to another server request
for which I haven't setup any pipelines yet and though they lead to
'core.manager.handled-errors' exceptions (confirmed by the logs).
Yourkit revealed that the size (retained size[1]) of CocoonServiceManager and
the TraxTransformer increases exceptionally. Garbage collection doesn't really
reduce the size of those objects.
Any ideas?
[1] Retained size of an object is its shallow size plus the shallow sizes of the
objects that are accessible, directly or indirectly, only from this object. In
other words, the retained size represents the amount of memory that will be
freed by garbage collector when this object is collected.
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
Re: Possible memory leak when handle-errors is called
Posted by Reinhard Poetz <re...@apache.org>.
Carsten Ziegeler wrote:
> Reinhard Poetz wrote:
>
>>Carsten Ziegeler wrote:
>>
>>
>>>Reinhard Poetz wrote:
>>>
>>>
>>>
>>>
>>>>yes, you can invoke any non exisiting pipeline like http://localhost:8888/asgfsg
>>>>
>>>>(I added System.out.println statements to setup() and recycle() as logging still
>>>>doesn't work for sitemap components.)
>>>>
>>>
>>>Ok, I'll have a look into both problems today - but can't promise
>>>anything :)
>>
>>
> The memory leak should be fixed now - the whole pipeline of the error
> handler was not released.
> Can you please verify this?
Yourkit shows that the memory leak has been fixed, thank you very much Carsten!
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
Re: Possible memory leak when handle-errors is called
Posted by Carsten Ziegeler <cz...@apache.org>.
Reinhard Poetz wrote:
> Carsten Ziegeler wrote:
>
>>Reinhard Poetz wrote:
>>
>>
>>
>>>yes, you can invoke any non exisiting pipeline like http://localhost:8888/asgfsg
>>>
>>>(I added System.out.println statements to setup() and recycle() as logging still
>>>doesn't work for sitemap components.)
>>>
>>
>>Ok, I'll have a look into both problems today - but can't promise
>>anything :)
>
>
The memory leak should be fixed now - the whole pipeline of the error
handler was not released.
Can you please verify this?
Carsten
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
Re: Possible memory leak when handle-errors is called
Posted by Reinhard Poetz <re...@apache.org>.
Carsten Ziegeler wrote:
> Reinhard Poetz wrote:
>
>
>>yes, you can invoke any non exisiting pipeline like http://localhost:8888/asgfsg
>>
>>(I added System.out.println statements to setup() and recycle() as logging still
>>doesn't work for sitemap components.)
>>
>
> Ok, I'll have a look into both problems today - but can't promise
> anything :)
Thanks!
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
Re: Possible memory leak when handle-errors is called
Posted by Carsten Ziegeler <cz...@apache.org>.
Reinhard Poetz wrote:
>
> yes, you can invoke any non exisiting pipeline like http://localhost:8888/asgfsg
>
> (I added System.out.println statements to setup() and recycle() as logging still
> doesn't work for sitemap components.)
>
Ok, I'll have a look into both problems today - but can't promise
anything :)
Carsten
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
Re: Possible memory leak when handle-errors is called
Posted by Reinhard Poetz <re...@apache.org>.
Carsten Ziegeler wrote:
> Reinhard Poetz wrote:
>
>
>>(I added System.out.println statements to setup() and recycle() as logging still
>>doesn't work for sitemap components.)
>>
>
> Ok, I fixed this as well - not only sitemap components were effected.
> Can you please verify this as well?
Works for me!
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
Re: Possible memory leak when handle-errors is called
Posted by Carsten Ziegeler <cz...@apache.org>.
Reinhard Poetz wrote:
>
> (I added System.out.println statements to setup() and recycle() as logging still
> doesn't work for sitemap components.)
>
Ok, I fixed this as well - not only sitemap components were effected.
Can you please verify this as well?
Thanks
Carsten
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
Re: Possible memory leak when handle-errors is called
Posted by Reinhard Poetz <re...@apache.org>.
Carsten Ziegeler wrote:
> Reinhard Poetz wrote:
>
>>not when the TraxTransformer is used in "handle-errors"-sections, in usual
>>pipelines yes. What's the difference?
>>
>
> (I guess you know this) The TraxTransformer is a pooled component, so
> after the request is finished, it should be put back into the pool. If
> it is put back into the pool, the recycle() method will be called.
> So, as the method is not called, it seems that the whole pipeline is not
> "recycled" after the request is finished.
which is strange as it works in for usual pipelines but not for handle-error
pipelines.
> When this happens you have a memory leak.
> Now, the remaining question is: why is the transformer not put back into
> the pool? I had a brief look at the code, but was soon lost...
> Do we have an example in our SVN? Can I just invoke a non existent pipeline?
yes, you can invoke any non exisiting pipeline like http://localhost:8888/asgfsg
(I added System.out.println statements to setup() and recycle() as logging still
doesn't work for sitemap components.)
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
Re: Possible memory leak when handle-errors is called
Posted by Carsten Ziegeler <cz...@apache.org>.
Reinhard Poetz wrote:
>
> not when the TraxTransformer is used in "handle-errors"-sections, in usual
> pipelines yes. What's the difference?
>
(I guess you know this) The TraxTransformer is a pooled component, so
after the request is finished, it should be put back into the pool. If
it is put back into the pool, the recycle() method will be called.
So, as the method is not called, it seems that the whole pipeline is not
"recycled" after the request is finished. When this happens you have a
memory leak.
Now, the remaining question is: why is the transformer not put back into
the pool? I had a brief look at the code, but was soon lost...
Do we have an example in our SVN? Can I just invoke a non existent pipeline?
Carsten
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
Re: Possible memory leak when handle-errors is called
Posted by Reinhard Poetz <re...@apache.org>.
Carsten Ziegeler wrote:
> Reinhard Poetz wrote:
>
>
>>AFAICS the usual behaviour is that there is only one TraxTransformer Object,
>>independently from the number of requests and different stylesheets.
>
> Hmm
>
>
>>As soon as
>>I call URIs that cause "handle-error" sections, new TraxTransformer objects are
>>created, when the handle-error sections contains an error. Setting the
>>"pool-max" attribute doesn't change this. AFAICS the TraxTransformer (+ all the
>>Xalan stuff) don't get garbage collected.
>
> So, is the "recycle()" method of the TraxTransformer called?
not when the TraxTransformer is used in "handle-errors"-sections, in usual
pipelines yes. What's the difference?
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
Re: Possible memory leak when handle-errors is called
Posted by Carsten Ziegeler <cz...@apache.org>.
Reinhard Poetz wrote:
> AFAICS the usual behaviour is that there is only one TraxTransformer Object,
> independently from the number of requests and different stylesheets.
Hmm
> As soon as
> I call URIs that cause "handle-error" sections, new TraxTransformer objects are
> created, when the handle-error sections contains an error. Setting the
> "pool-max" attribute doesn't change this. AFAICS the TraxTransformer (+ all the
> Xalan stuff) don't get garbage collected.
So, is the "recycle()" method of the TraxTransformer called?
Carsten
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
Re: Possible memory leak when handle-errors is called
Posted by Reinhard Poetz <re...@apache.org>.
Carsten Ziegeler wrote:
> Reinhard Poetz wrote:
>
>>I noticed that the memory consumption of my 2.2 applications (I haven't looked
>>into BRANCH_2.1.X yet) is steadily increasing. First I blamed the HTMLGenerator,
>>then I found out that the produced HTML contains a lot of img, script, link and
>>iframe tags. Those tags have in common that they lead to another server request
>>for which I haven't setup any pipelines yet and though they lead to
>>'core.manager.handled-errors' exceptions (confirmed by the logs).
>>
>>Yourkit revealed that the size (retained size[1]) of CocoonServiceManager and
>>the TraxTransformer increases exceptionally. Garbage collection doesn't really
>>reduce the size of those objects.
>>
>>Any ideas?
>>
>
> Gets the TraxTransformer recycled?
AFAICS the usual behaviour is that there is only one TraxTransformer Object,
independently from the number of requests and different stylesheets. As soon as
I call URIs that cause "handle-error" sections, new TraxTransformer objects are
created, when the handle-error sections contains an error. Setting the
"pool-max" attribute doesn't change this. AFAICS the TraxTransformer (+ all the
Xalan stuff) don't get garbage collected.
> Or perhaps the stylesheet caching
> mechanism does not work correctly. Each new stylesheet is by default
> cached in memory.
This doesn't seem to be the problem.
What's strange is the increasing number of SimpleNotifyingBean objects. Each
error creates a new instance of a SimpleNotifyingBean and they don't get garbage
collected either.
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
Re: Possible memory leak when handle-errors is called
Posted by Carsten Ziegeler <cz...@apache.org>.
Reinhard Poetz wrote:
> I noticed that the memory consumption of my 2.2 applications (I haven't looked
> into BRANCH_2.1.X yet) is steadily increasing. First I blamed the HTMLGenerator,
> then I found out that the produced HTML contains a lot of img, script, link and
> iframe tags. Those tags have in common that they lead to another server request
> for which I haven't setup any pipelines yet and though they lead to
> 'core.manager.handled-errors' exceptions (confirmed by the logs).
>
> Yourkit revealed that the size (retained size[1]) of CocoonServiceManager and
> the TraxTransformer increases exceptionally. Garbage collection doesn't really
> reduce the size of those objects.
>
> Any ideas?
>
Gets the TraxTransformer recycled? Or perhaps the stylesheet caching
mechanism does not work correctly. Each new stylesheet is by default
cached in memory.
Carsten
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/