You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Ronan Klyne <ro...@groupbc.com> on 2009/09/28 16:08:13 UTC
[solved] Re: Possible memory leaks when running consecutive thread
groups
I have tracked down the flaw in my understanding!
The data I store in the JMeterVariables structure exposed as 'vars' is
being stored for the duration of the test. I think this is a fault with
JMeter, as it is of no use once the thread group has finished. I have
worked around this by using a BSF sampler in the logout routine at the
end of my test, with this javascript (it overwrites selected variable
names with null.):
"""
OUT.println("Clearing vars.");
names = [
'ws_ids',
'container',
'can_upload',
'multiselect_mod',
'document',
'no_responses',
'navigation_xml_flags_cache',
];
for (var i = 0; i < names.length; i++) {
vars.put(names[i], null);
}
OUT.println("Cleared vars.");
"""
I hope that helps anyone else running into this problem...
Ronan
sebb wrote:
> 2009/9/24 Ronan Klyne <ro...@groupbc.com>:
>
>> Hi all,
>>
>> I've got a fairly sizeable test plan with several thread groups in in,
>> configured to run consecutively.
>>
>> These thread groups run the same test (a large test, linked to with a module
>> controller) with increasing numbers of users, from 2 to 20, in steps of 2.
>>
>> I can successfully run the test for 20 users (having disabled the other
>> thread groups), but I cannot run the full set.
>> When I run the whole lot together I get memory errors upon reaching the 20th
>> thread group.
>>
>
> Can you give JMeter more memory?
>
>
>> I can't see any reason why this should be the case, so I come to you for
>> help... To my knowledge, there should not be any data preserved between
>> thread groups, and therefore there should be no memory used between thread
>> groups.
>>
>> I don't have any Java samplers, but there are a couple of beanshell samplers
>>
>
> There are some reports that BeanShell can leak memory.
>
>
>> and pre/post processors for which I have checked the code and found no
>> variables that would be left around aside from those I put in the
>> JMeterVariables construct exposed as 'vars', which are meant to be cleaned
>> between thread groups, if I understand correctly.
>>
>> I have also removed all listeners except one data writer.
>>
>> I cannot explain why I can run tests independently, but I can't run them all
>> in one JMeter process. Any ideas?
>>
>
> If you can't fix the problem, why not create a test with a single
> thread group, and use a property to define the thread count.
>
> You can then create a script to run the test repeatedly, passing in
> the appropriate thread count.
>
>
>> Thanks in advance,
>>
>> Ronan
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: [solved] Re: Possible memory leaks when running consecutive
thread groups
Posted by Ronan Klyne <ro...@groupbc.com>.
sebb wrote:
> On 28/09/2009, Ronan Klyne <ro...@groupbc.com> wrote:
>
>> I have tracked down the flaw in my understanding!
>>
>> The data I store in the JMeterVariables structure exposed as 'vars' is
>> being stored for the duration of the test. I think this is a fault with
>> JMeter, as it is of no use once the thread group has finished.
>>
>
> As far as I can tell, the JMeter variables should become available for
> garbage collection as soon as the relevant JMeterThread exits. If they
> are not (perhaps a circular reference), then this is a bug.
>
I'll check it out with the latest nightly.
Thanks Seb
>> I have worked
>> around this by using a BSF sampler in the logout routine at the end of my
>> test, with this javascript (it overwrites selected variable names with
>> null.):
>>
>> """
>> OUT.println("Clearing vars.");
>> names = [
>> 'ws_ids',
>> 'container',
>> 'can_upload',
>> 'multiselect_mod',
>> 'document',
>> 'no_responses',
>> 'navigation_xml_flags_cache',
>> ];
>> for (var i = 0; i < names.length; i++) {
>> vars.put(names[i], null);
>>
>
> Might be better to use
>
> vars.remove(names[i]);
>
True. I'm just catering to some of my own hacky code ;-)
>
>> }
>> OUT.println("Cleared vars.");
>> """
>>
>> I hope that helps anyone else running into this problem...
>>
>>
>> Ronan
>>
>>
>> sebb wrote:
>>
>>
>>> 2009/9/24 Ronan Klyne <ro...@groupbc.com>:
>>>
>>>
>>>
>>>> Hi all,
>>>>
>>>> I've got a fairly sizeable test plan with several thread groups in in,
>>>> configured to run consecutively.
>>>>
>>>> These thread groups run the same test (a large test, linked to with a
>>>>
>> module
>>
>>>> controller) with increasing numbers of users, from 2 to 20, in steps of
>>>>
>> 2.
>>
>>>> I can successfully run the test for 20 users (having disabled the other
>>>> thread groups), but I cannot run the full set.
>>>> When I run the whole lot together I get memory errors upon reaching the
>>>>
>> 20th
>>
>>>> thread group.
>>>>
>>>>
>>>>
>>> Can you give JMeter more memory?
>>>
>>>
>>>
>>>
>>>> I can't see any reason why this should be the case, so I come to you for
>>>> help... To my knowledge, there should not be any data preserved between
>>>> thread groups, and therefore there should be no memory used between
>>>>
>> thread
>>
>>>> groups.
>>>>
>>>> I don't have any Java samplers, but there are a couple of beanshell
>>>>
>> samplers
>>
>>>>
>>> There are some reports that BeanShell can leak memory.
>>>
>>>
>>>
>>>
>>>> and pre/post processors for which I have checked the code and found no
>>>> variables that would be left around aside from those I put in the
>>>> JMeterVariables construct exposed as 'vars', which are meant to be
>>>>
>> cleaned
>>
>>>> between thread groups, if I understand correctly.
>>>>
>>>> I have also removed all listeners except one data writer.
>>>>
>>>> I cannot explain why I can run tests independently, but I can't run them
>>>>
>> all
>>
>>>> in one JMeter process. Any ideas?
>>>>
>>>>
>>>>
>>> If you can't fix the problem, why not create a test with a single
>>> thread group, and use a property to define the thread count.
>>>
>>> You can then create a script to run the test repeatedly, passing in
>>> the appropriate thread count.
>>>
>>>
>>>
>>>
>>>> Thanks in advance,
>>>>
>>>> Ronan
>>>>
>>>>
>>>>
>>>>
>>>>
>> ---------------------------------------------------------------------
>>
>>>> To unsubscribe, e-mail:
>>>>
>> jmeter-user-unsubscribe@jakarta.apache.org
>>
>>>> For additional commands, e-mail:
>>>>
>> jmeter-user-help@jakarta.apache.org
>>
>>>>
>>>>
>>>>
>>>
>> ---------------------------------------------------------------------
>>
>>> To unsubscribe, e-mail:
>>>
>> jmeter-user-unsubscribe@jakarta.apache.org
>>
>>> For additional commands, e-mail:
>>>
>> jmeter-user-help@jakarta.apache.org
>>
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail:
>> jmeter-user-help@jakarta.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: [solved] Re: Possible memory leaks when running consecutive
thread groups
Posted by sebb <se...@gmail.com>.
On 28/09/2009, Ronan Klyne <ro...@groupbc.com> wrote:
> I have tracked down the flaw in my understanding!
>
> The data I store in the JMeterVariables structure exposed as 'vars' is
> being stored for the duration of the test. I think this is a fault with
> JMeter, as it is of no use once the thread group has finished.
As far as I can tell, the JMeter variables should become available for
garbage collection as soon as the relevant JMeterThread exits. If they
are not (perhaps a circular reference), then this is a bug.
> I have worked
> around this by using a BSF sampler in the logout routine at the end of my
> test, with this javascript (it overwrites selected variable names with
> null.):
>
> """
> OUT.println("Clearing vars.");
> names = [
> 'ws_ids',
> 'container',
> 'can_upload',
> 'multiselect_mod',
> 'document',
> 'no_responses',
> 'navigation_xml_flags_cache',
> ];
> for (var i = 0; i < names.length; i++) {
> vars.put(names[i], null);
Might be better to use
vars.remove(names[i]);
> }
> OUT.println("Cleared vars.");
> """
>
> I hope that helps anyone else running into this problem...
>
>
> Ronan
>
>
> sebb wrote:
>
> > 2009/9/24 Ronan Klyne <ro...@groupbc.com>:
> >
> >
> > > Hi all,
> > >
> > > I've got a fairly sizeable test plan with several thread groups in in,
> > > configured to run consecutively.
> > >
> > > These thread groups run the same test (a large test, linked to with a
> module
> > > controller) with increasing numbers of users, from 2 to 20, in steps of
> 2.
> > >
> > > I can successfully run the test for 20 users (having disabled the other
> > > thread groups), but I cannot run the full set.
> > > When I run the whole lot together I get memory errors upon reaching the
> 20th
> > > thread group.
> > >
> > >
> >
> > Can you give JMeter more memory?
> >
> >
> >
> > > I can't see any reason why this should be the case, so I come to you for
> > > help... To my knowledge, there should not be any data preserved between
> > > thread groups, and therefore there should be no memory used between
> thread
> > > groups.
> > >
> > > I don't have any Java samplers, but there are a couple of beanshell
> samplers
> > >
> > >
> >
> > There are some reports that BeanShell can leak memory.
> >
> >
> >
> > > and pre/post processors for which I have checked the code and found no
> > > variables that would be left around aside from those I put in the
> > > JMeterVariables construct exposed as 'vars', which are meant to be
> cleaned
> > > between thread groups, if I understand correctly.
> > >
> > > I have also removed all listeners except one data writer.
> > >
> > > I cannot explain why I can run tests independently, but I can't run them
> all
> > > in one JMeter process. Any ideas?
> > >
> > >
> >
> > If you can't fix the problem, why not create a test with a single
> > thread group, and use a property to define the thread count.
> >
> > You can then create a script to run the test repeatedly, passing in
> > the appropriate thread count.
> >
> >
> >
> > > Thanks in advance,
> > >
> > > Ronan
> > >
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> jmeter-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> jmeter-user-help@jakarta.apache.org
> > >
> > >
> > >
> > >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> jmeter-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> jmeter-user-help@jakarta.apache.org
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> jmeter-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org