Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If Controller of jMeter throws StackOverflowError

I am using jMeter to load my system. I have two Thread Groups. The first one should inject about 1M events, while the second one mimic requests to UI.

I need the second thread group to continue sending request to the UI, until the first one finishes injecting the 1M events.

I have found this solution, and implemented it as follows:

  1. In the first thread group, I have added BeanShell PreProcessor with the following code:

    props.put("DONE", "FALSE");

  2. Still in the first thread group, I have added BeanShell PostProcessor with the following code:

    int activeThreadCount = org.apache.jmeter.threads.JMeterContextService.getNumberOfThreads();

    if (activeThreadCount <= 1)
    {
    props.put("DONE", "TRUE");
    }
    
  3. In the second thread group I have added an If Controller with the following condition:

    ${__BeanShell( props.get("DONE") != null && props.get("DONE")=="TRUE")}

This solution is not working and I see the following error at the end of the test:

2016/12/22 20:52:30 ERROR - jmeter.threads.JMeterThread: Test failed! java.lang.StackOverflowError at java.lang.String.valueOf(Unknown Source) at java.lang.StringBuilder.append(Unknown Source) at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:152) at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:117) at org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:101) at org.apache.jmeter.testelement.AbstractTestElement.getPropertyAsString(AbstractTestElement.java:271) at org.apache.jmeter.control.IfController.getCondition(IfController.java:177) at org.apache.jmeter.control.IfController.next(IfController.java:240) at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:222) at org.apache.jmeter.control.GenericController.next(GenericController.java:176) at org.apache.jmeter.control.LoopController.next(LoopController.java:123) at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:225) at org.apache.jmeter.control.GenericController.next(GenericController.java:176) at org.apache.jmeter.control.LoopController.next(LoopController.java:123) at org.apache.jmeter.control.LoopController.nextIsNull(LoopController.java:151) at org.apache.jmeter.control.GenericController.next(GenericController.java:171) at org.apache.jmeter.control.LoopController.next(LoopController.java:123)

......

......

......

(Continue for about 1000 line as above)

Can any one tell me what is the source of this error? Can I simply ignore it? It looks like it is a recursive operation without any stop condition.

Thanks Guy H

like image 812
Guy Hudara Avatar asked Dec 23 '16 09:12

Guy Hudara


People also ask

What does StackOverflowError mean?

What is stack overflow? A stack overflow is a type of buffer overflow error that occurs when a computer program tries to use more memory space in the call stack than has been allocated to that stack.

How do I stop StackOverflowError in Java?

Increase Thread Stack Size (-Xss) Increasing the stack size can be useful, for example, when the program involves calling a large number of methods or using lots of local variables. This will set the thread's stack size to 4 mb which should prevent the JVM from throwing a java. lang. StackOverflowError .


1 Answers

This could be an old bug in JMeter < 2.12 if the If Controller is the only child of LoopController and it is false on start.

There has been some fixes in recent versions of JMeter:

  • https://bz.apache.org/bugzilla/show_bug.cgi?id=56160

Try with new versions of JMeter

The workaround is to add as first child of Loop Controller a Test Action (renamed to Flow Control Action since 5.0) with pause = 0

like image 191
UBIK LOAD PACK Avatar answered Dec 25 '22 12:12

UBIK LOAD PACK