1

I have the following test plan

  • thread-group ( threads: "1", loops: "-1", ramp-up: "1" )
    • http request defaults (i.e url)
    • csv data set config (containing 4 lines of input data)
    • user defined variables (initialize variables e.g isLast=false)
    • simple controller
      • while controller
        • http request
          • json extractor
          • json extractor
          • JSR233 PostProcessor

The json extractor and post processor are because i want to handle pagination and increment the page number accordingly.

The first issue is that although i set up the thread-group to run infinitely, when the thread finishes it does not run again and i get the following error.

021-08-27 14:15:38,686 INFO o.a.j.e.J.increment page: isLast = true
2021-08-27 14:15:38,738 INFO o.a.j.t.JMeterThread: Thread finished: dba-data-exporter-users 1-1
2021-08-27 14:15:38,738 ERROR o.a.j.JMeter: Uncaught exception in thread Thread[dba-data-exporter-users 1-1,6,main]
java.lang.StackOverflowError: null
    at java.lang.Module.isExported(Module.java:456) ~[?:?]
    at jdk.internal.reflect.Reflection.verifyModuleAccess(Reflection.java:212) ~[?:?]
    at jdk.internal.reflect.Reflection.verifyMemberAccess(Reflection.java:125) ~[?:?]
    at java.lang.reflect.AccessibleObject.slowVerifyAccess(AccessibleObject.java:633) ~[?:?]
    at java.lang.reflect.AccessibleObject.verifyAccess(AccessibleObject.java:626) ~[?:?]
    at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:590) ~[?:?]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:481) ~[?:?]
    at org.codehaus.groovy.runtime.InvokerHelper.newScript(InvokerHelper.java:503) ~[groovy-3.0.7.jar:3.0.7]
    at org.codehaus.groovy.runtime.InvokerHelper.createScript(InvokerHelper.java:461) ~[groovy-3.0.7.jar:3.0.7]
    at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:266) ~[groovy-jsr223-3.0.7.jar:3.0.7]
    at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155) ~[groovy-jsr223-3.0.7.jar:3.0.7]
    at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233) ~[java.scripting:?]
    at org.apache.jmeter.functions.Groovy.execute(Groovy.java:120) ~[ApacheJMeter_functions.jar:5.4.1]
    at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:138) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:113) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:100) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.control.WhileController.getCondition(WhileController.java:142) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.control.WhileController.endOfLoop(WhileController.java:62) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.control.WhileController.next(WhileController.java:112) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:222) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.control.GenericController.next(GenericController.java:175) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:222) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.control.GenericController.next(GenericController.java:175) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.control.LoopController.next(LoopController.java:134) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.control.LoopController.nextIsNull(LoopController.java:166) ~[ApacheJMeter_core.jar:5.4.1]

Is it something that has to do with my while loop maybe? The condition i have in my while loop is this ${__groovy("false".equals(vars.get("isLast")))}

The other issue that i have noticed, is that although i specify thread lifetime through the GUI, jmeter does not take that in to account at all (while i generate the schematic view for example).

I don't believe that CSV file is the issue, since i have already set recycle on EOF to true, stop thread on EOF to false and sharing mode to Current thread group

Grigoris
  • 149
  • 1
  • 10
  • 1
    The `Groovy` function is fine. Can you debug the script with the [Step-by-step debugger](https://github.com/Blazemeter/jmeter-debugger)? Also, change the While controller to a simple controller and see if the script works for one iteration. The test duration should work when you set the `loop count` to infinite (check of -1) , check `Specify Thread Lifetime` and Duration. – Janesh Kodikara Aug 28 '21 at 10:55
  • I was able to reproduce the error. Let me check further – Janesh Kodikara Aug 28 '21 at 13:36

1 Answers1

1

The thread goes into an infinite loop after completing the while loop. The isLast flag is not reset to true when you go outside the While loop. Hence the thread will never enter the while loop after the first cycle.

You can reset the flag to true at the end of the thread group or before entering into the While loop.

Add a JSRS223 Sampler and add the following

vars.put("isLast","false")
SampleResult.setIgnore()

enter image description here

Janesh Kodikara
  • 1,670
  • 1
  • 12
  • 23