Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

controller as first child of If Controller causes exception when conditional is false #2495

Closed
asfimport opened this issue May 26, 2011 · 2 comments

Comments

@asfimport
Copy link
Collaborator

Chris Newell (Bug 51272):
Using JMeter-r1095243 (a semi-recent nightly)

When the first child of an If Controller is a Controller an exception is thrown when the condition for the If Controller is false.

Exception:

2011/05/26 12:33:28 INFO - jmeter.threads.JMeterThread: Thread started: BUGGED 1-1
2011/05/26 12:33:28 INFO - jmeter.util.BeanShellTestElement: beanshell ran
2011/05/26 12:33:29 ERROR - jmeter.threads.JMeterThread: Test failed! java.lang.StackOverflowError
at java.lang.String.indexOf(Unknown Source)
at java.lang.ClassLoader.checkName(Unknown Source)
at java.lang.ClassLoader.findLoadedClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.mozilla.javascript.DefiningClassLoader.loadClass(DefiningClassLoader.java:72)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.mozilla.javascript.optimizer.Codegen.createScriptObject(Codegen.java:83)
at org.mozilla.javascript.Context.compileImpl(Context.java:2280)
at org.mozilla.javascript.Context.compileString(Context.java:1284)
at org.mozilla.javascript.Context.compileString(Context.java:1273)
at org.mozilla.javascript.Context.evaluateString(Context.java:1129)
at org.apache.jmeter.control.IfController.evaluateCondition(IfController.java:105)
at org.apache.jmeter.control.IfController.next(IfController.java:162)
at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:187)
at org.apache.jmeter.control.GenericController.reInitializeSubController(GenericController.java:229)
at org.apache.jmeter.control.GenericController.reInitializeSubController(GenericController.java:230)

[REPEATED ~1000 times]

Created attachment BugReport.jmx: run 'BUGGED' thread and review jmeter.log

BugReport.jmx
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.1">
  <hashTree>
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="BUG REPORT" enabled="true">
      <stringProp name="TestPlan.comments">controller as first child of If Controller causes exception when conditional is false</stringProp>
      <boolProp name="TestPlan.functional_mode">false</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="BUGGED" enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">stoptest</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">3</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time"></stringProp>
        <longProp name="ThreadGroup.start_time">1305729236000</longProp>
        <longProp name="ThreadGroup.end_time">1305729236000</longProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
        <stringProp name="TestPlan.comments">Throws exception (see log)</stringProp>
      </ThreadGroup>
      <hashTree>
        <ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="Aggregate Report" enabled="true">
          <boolProp name="ResultCollector.error_logging">false</boolProp>
          <objProp>
            <name>saveConfig</name>
            <value class="SampleSaveConfiguration">
              <time>true</time>
              <latency>true</latency>
              <timestamp>true</timestamp>
              <success>true</success>
              <label>true</label>
              <code>true</code>
              <message>true</message>
              <threadName>true</threadName>
              <dataType>true</dataType>
              <encoding>false</encoding>
              <assertions>true</assertions>
              <subresults>true</subresults>
              <responseData>false</responseData>
              <samplerData>false</samplerData>
              <xml>true</xml>
              <fieldNames>false</fieldNames>
              <responseHeaders>false</responseHeaders>
              <requestHeaders>false</requestHeaders>
              <responseDataOnError>false</responseDataOnError>
              <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
              <assertionsResultsToSave>0</assertionsResultsToSave>
              <bytes>true</bytes>
            </value>
          </objProp>
          <stringProp name="filename"></stringProp>
          <boolProp name="saveHeaders">false</boolProp>
        </ResultCollector>
        <hashTree/>
        <DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="Debug Sampler" enabled="true">
          <boolProp name="displayJMeterProperties">true</boolProp>
          <boolProp name="displayJMeterVariables">true</boolProp>
          <boolProp name="displaySystemProperties">true</boolProp>
        </DebugSampler>
        <hashTree>
          <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="BeanShell PostProcessor" enabled="true">
            <stringProp name="TestPlan.comments">NOTE: if this matches the conditional in the If Controller then no exception</stringProp>
            <boolProp name="resetInterpreter">true</boolProp>
            <stringProp name="parameters"></stringProp>
            <stringProp name="filename"></stringProp>
            <stringProp name="script">vars.put(&quot;NO_MATCH&quot;, &quot;0&quot;);
log.info(&quot;beanshell ran&quot;);</stringProp>
          </BeanShellPostProcessor>
          <hashTree/>
        </hashTree>
        <IfController guiclass="IfControllerPanel" testclass="IfController" testname="If Controller" enabled="true">
          <stringProp name="IfController.condition">&quot;${NO_MATCH}&quot; == &quot;1&quot;</stringProp>
          <boolProp name="IfController.evaluateAll">false</boolProp>
        </IfController>
        <hashTree>
          <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="BUGGED" enabled="true">
            <stringProp name="TestPlan.comments">removing this controller eliminates exception</stringProp>
          </GenericController>
          <hashTree>
            <DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="conditional sampler" enabled="true">
              <boolProp name="displayJMeterProperties">true</boolProp>
              <boolProp name="displayJMeterVariables">true</boolProp>
              <boolProp name="displaySystemProperties">true</boolProp>
            </DebugSampler>
            <hashTree/>
          </hashTree>
        </hashTree>
      </hashTree>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="NOT BUGGED" enabled="false">
        <stringProp name="ThreadGroup.on_sample_error">stoptest</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">3</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time"></stringProp>
        <longProp name="ThreadGroup.start_time">1305729236000</longProp>
        <longProp name="ThreadGroup.end_time">1305729236000</longProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
        <stringProp name="TestPlan.comments">This works without issue</stringProp>
      </ThreadGroup>
      <hashTree>
        <ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="Aggregate Report" enabled="true">
          <boolProp name="ResultCollector.error_logging">false</boolProp>
          <objProp>
            <name>saveConfig</name>
            <value class="SampleSaveConfiguration">
              <time>true</time>
              <latency>true</latency>
              <timestamp>true</timestamp>
              <success>true</success>
              <label>true</label>
              <code>true</code>
              <message>true</message>
              <threadName>true</threadName>
              <dataType>true</dataType>
              <encoding>false</encoding>
              <assertions>true</assertions>
              <subresults>true</subresults>
              <responseData>false</responseData>
              <samplerData>false</samplerData>
              <xml>true</xml>
              <fieldNames>false</fieldNames>
              <responseHeaders>false</responseHeaders>
              <requestHeaders>false</requestHeaders>
              <responseDataOnError>false</responseDataOnError>
              <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
              <assertionsResultsToSave>0</assertionsResultsToSave>
              <bytes>true</bytes>
            </value>
          </objProp>
          <stringProp name="filename"></stringProp>
          <boolProp name="saveHeaders">false</boolProp>
        </ResultCollector>
        <hashTree/>
        <DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="Debug Sampler" enabled="true">
          <boolProp name="displayJMeterProperties">true</boolProp>
          <boolProp name="displayJMeterVariables">true</boolProp>
          <boolProp name="displaySystemProperties">true</boolProp>
        </DebugSampler>
        <hashTree>
          <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="BeanShell PostProcessor" enabled="true">
            <boolProp name="resetInterpreter">false</boolProp>
            <stringProp name="parameters"></stringProp>
            <stringProp name="filename"></stringProp>
            <stringProp name="script">vars.put(&quot;NO_MATCH&quot;, &quot;0&quot;);
log.info(&quot;beanshell ran&quot;);</stringProp>
          </BeanShellPostProcessor>
          <hashTree/>
        </hashTree>
        <IfController guiclass="IfControllerPanel" testclass="IfController" testname="If Controller" enabled="true">
          <stringProp name="IfController.condition">&quot;${NO_MATCH}&quot; == &quot;1&quot;</stringProp>
          <boolProp name="IfController.evaluateAll">false</boolProp>
        </IfController>
        <hashTree>
          <DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="conditional sampler" enabled="true">
            <boolProp name="displayJMeterProperties">true</boolProp>
            <boolProp name="displayJMeterVariables">true</boolProp>
            <boolProp name="displaySystemProperties">true</boolProp>
          </DebugSampler>
          <hashTree/>
        </hashTree>
      </hashTree>
    </hashTree>
  </hashTree>
</jmeterTestPlan>

Version: Nightly
Severity: normal
OS: All

Duplicated by:

@asfimport
Copy link
Collaborator Author

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
This bug has been marked as a duplicate of #2456

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant