You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Andrew van der Voort <an...@astarte.co.nz> on 2003/08/11 07:21:49 UTC

Testing and memory consumption

Hi.

A wee while ago we asked about a problem we were having when testing our
application with cactus. The memory on the server just keeps going up and
up and up until the tests are complete. More tests, more memory
consumption. No-one was able to provide any information on this, but I have
a further piece of information that might help trigger something for one of
you experts out there.

Background
Ours is a struts application. We are using strutstestcase as our front end
to the tests. 

I am just upgrading our application to struts 1.1. I discovered that one of
the things I needed to do was write a plugin. I performed some logging in
this plugin so that on application server startup it was abundantly clear
that this was a testing deployment.

I have noticed that when running our tests the plugin is being initialised
on every test.

Plugins are supposed to be run once during struts initialisation and that
is it. So somewhere in the sequence of events involving strutstestcase
and/or cactus, struts must be being initialised for every test. This would
probably explain the memory consumption. The $64,000 question is why is
this happening, and it is with this that I am hoping one of you out there
can help me.

Anyone got any ideas?

Thanks

Andrew

RE: Testing and memory consumption

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Andrew,

You can send the $64,000 check to me! :-)

Here is what I believe is happening:

- A Cactus test is a unit test and every test must be a separate as the
others from possible (to prevent side effects and because unit tests are
not ordered). This is probably why strutstestcase initialize Struts for
each test (and this is normal and good).

- As for the memory, what must happen is that the HTTP sessions are not
destroyed after each test. By default they are destroyed after a timeout
inactivity (usually 30 minutes). But if you run lots of tests in quick
period of time, the memory grows (and if there are lots of objects in
the session it grows fast - Struts must be putting a few things there).

One solution ATM is to discard the session in a tearDown() method (call
invalidate()).

That said, this should probably been done by Cactus and will be an
improvement.

Thanks
-Vincent

> -----Original Message-----
> From: Andrew van der Voort [mailto:andrew@astarte.co.nz]
> Sent: 11 August 2003 07:22
> To: cactus-user@jakarta.apache.org
> Subject: Testing and memory consumption
> 
> Hi.
> 
> A wee while ago we asked about a problem we were having when testing
our
> application with cactus. The memory on the server just keeps going up
and
> up and up until the tests are complete. More tests, more memory
> consumption. No-one was able to provide any information on this, but I
> have
> a further piece of information that might help trigger something for
one
> of
> you experts out there.
> 
> Background
> Ours is a struts application. We are using strutstestcase as our front
end
> to the tests.
> 
> I am just upgrading our application to struts 1.1. I discovered that
one
> of
> the things I needed to do was write a plugin. I performed some logging
in
> this plugin so that on application server startup it was abundantly
clear
> that this was a testing deployment.
> 
> I have noticed that when running our tests the plugin is being
initialised
> on every test.
> 
> Plugins are supposed to be run once during struts initialisation and
that
> is it. So somewhere in the sequence of events involving strutstestcase
> and/or cactus, struts must be being initialised for every test. This
would
> probably explain the memory consumption. The $64,000 question is why
is
> this happening, and it is with this that I am hoping one of you out
there
> can help me.
> 
> Anyone got any ideas?
> 
> Thanks
> 
> Andrew
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org