apache / jmeter

Apache JMeter open-source load testing tool for analyzing and measuring the performance of a variety of services
https://jmeter.apache.org/
Apache License 2.0
8.25k stars 2.09k forks source link

StackOverFlow error returned for IF controller when Loop count is set to forever #4872

Open asfimport opened 5 years ago

asfimport commented 5 years ago

Rohit Pal (Bug 62760): Under Thread Group, give any number of threads, rampup and scheduler duration as you need but set Loop count to forever. Add If controller under same thread group and add one HTTP Sampler. Under If controller, uncheck Interpret Condition as Variable Expression? and set condition is such a way that it should return false. For e.g "PASS"=="PASSED" (This will return false) Now if you run the script, In console, you can find UncaughtException --

2018-09-26 11:25:06,132 ERROR o.a.j.JMeter: Uncaught exception: java.lang.StackOverflowError: null at org.apache.jmeter.threads.JMeterContextService.getContext(JMeterContextService.java:60) ~[ApacheJMeter_core.jar:5.0 r1840935] at org.apache.jmeter.engine.util.SimpleVariable.getVariables(SimpleVariable.java:65) ~[ApacheJMeter_core.jar:5.0 r1840935] at org.apache.jmeter.engine.util.SimpleVariable.toString(SimpleVariable.java:51) ~[ApacheJMeter_core.jar:5.0 r1840935] at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:142) ~[ApacheJMeter_core.jar:5.0 r1840935] at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:111) ~[ApacheJMeter_core.jar:5.0 r1840935] at org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:101) ~[ApacheJMeter_core.jar:5.0 r1840935] at org.apache.jmeter.testelement.AbstractTestElement.getPropertyAsString(AbstractTestElement.java:281) ~[ApacheJMeter_core.jar:5.0 r1840935] at org.apache.jmeter.control.IfController.getCondition(IfController.java:177) ~[ApacheJMeter_core.jar:5.0 r1840935] at org.apache.jmeter.control.IfController.next(IfController.java:237) ~[ApacheJMeter_core.jar:5.0 r1840935] at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:222) ~[ApacheJMeter_core.jar:5.0 r1840935] at org.apache.jmeter.control.GenericController.next(GenericController.java:175) ~[ApacheJMeter_core.jar:5.0 r1840935] at org.apache.jmeter.control.LoopController.next(LoopController.java:134) ~[ApacheJMeter_core.jar:5.0 r1840935] at org.apache.jmeter.control.LoopController.nextIsNull(LoopController.java:166) ~[ApacheJMeter_core.jar:5.0 r1840935] at org.apache.jmeter.control.GenericController.next(GenericController.java:170) ~[ApacheJMeter_core.jar:5.0 r1840935] at org.apache.jmeter.control.LoopController.next(LoopController.java:134) ~[ApacheJMeter_core.jar:5.0 r1840935] at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:225) ~[ApacheJMeter_core.jar:5.0 r1840935] at org.apache.jmeter.control.GenericController.next(GenericController.java:175) ~[ApacheJMeter_core.jar:5.0 r18

Created attachment SlackOverFlow_IfController_LoopForever.jmx: Jmx file - Please refer attached jmx file wherein Loop count is set to Forever, under If controller - condition is set to false and Interpret condition as variable expression is uncheck

SlackOverFlow_IfController_LoopForever.jmx ````xml false true false varPhase PASS = continue false -1 1 1 true 5 "PASS"=="PASSED" false www.google.com/ https GET true false true false false saveConfig true true true true true true true false true true false false false true false false false true 0 true true true true true true ````

Severity: minor OS: All

Duplicates:

asfimport commented 5 years ago

Rohit Pal (migrated from Bugzilla): Created attachment jmeter.log: Refer Log file for detail console log

asfimport commented 5 years ago

@pmouawad (migrated from Bugzilla): This behaviour exists since at least version 3.3.

asfimport commented 5 years ago

justin (migrated from Bugzilla): (In reply to Rohit Pal from comment 1)

Created attachment 36163 [details] Refer Log file for detail console log

Can you explain the use/purpose of your If Controller? why is your condition plainly "PASS"=="PASSED"

If you set an infinite loop that pings google for results, what are you expecting it to do instead of StackOverflow-ing?

asfimport commented 5 years ago

@ham1 (migrated from Bugzilla): Rohit Pal, what behavior were you trying to achieve in your script? Is it to poll for a condition? Or was it just to demonstrate the possibility of a crash?

rabelenda commented 1 year ago

Hello, I just reproduced the same issue while testing with 5000 iterations, 1 thread and an ifController with a condition that evaluates to false. In my case I just configured the condition incorrectly, but I think it wouldn't be expected to get a StackOverflow.

I tested with JMeter 4.0, 5.0, 5.5 & 5.6.

Here is a sample test plan:

<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="4.0" jmeter="4.0 r1823414">
  <hashTree>
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
      <stringProp name="TestPlan.comments"></stringProp>
      <boolProp name="TestPlan.functional_mode">false</boolProp>
      <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
      <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
        <collectionProp name="Arguments.arguments"/>
      </elementProp>
      <stringProp name="TestPlan.user_define_classpath"></stringProp>
    </TestPlan>
    <hashTree>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <stringProp name="LoopController.loops">5000</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
      </ThreadGroup>
      <hashTree>
        <IfController guiclass="IfControllerPanel" testclass="IfController" testname="If Controller" enabled="true">
          <stringProp name="IfController.condition">false</stringProp>
          <boolProp name="IfController.evaluateAll">false</boolProp>
          <boolProp name="IfController.useExpression">true</boolProp>
        </IfController>
        <hashTree>
          <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="JSR223 Sampler" enabled="true">
            <stringProp name="cacheKey">true</stringProp>
            <stringProp name="filename"></stringProp>
            <stringProp name="parameters"></stringProp>
            <stringProp name="script">&quot;OK&quot;</stringProp>
            <stringProp name="scriptLanguage">groovy</stringProp>
          </JSR223Sampler>
          <hashTree/>
        </hashTree>
      </hashTree>
    </hashTree>
  </hashTree>
</jmeterTestPlan>