You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2018/01/30 21:38:15 UTC

svn commit: r1822704 - in /jmeter/trunk: src/components/org/apache/jmeter/control/ThroughputController.java test/src/org/apache/jmeter/control/ThroughputControllerSpec.groovy xdocs/changes.xml

Author: pmouawad
Date: Tue Jan 30 21:38:15 2018
New Revision: 1822704

URL: http://svn.apache.org/viewvc?rev=1822704&view=rev
Log:
Bug 62062 - ThroughputController: StackOverFlowError triggered when throughput=0 (Total Executions or Percentage Executions)
This closes #373
Partly contributed by Artem Fedorov
Bugzilla Id: 62062

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/control/ThroughputController.java
    jmeter/trunk/test/src/org/apache/jmeter/control/ThroughputControllerSpec.groovy
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/components/org/apache/jmeter/control/ThroughputController.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/control/ThroughputController.java?rev=1822704&r1=1822703&r2=1822704&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/control/ThroughputController.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/control/ThroughputController.java Tue Jan 30 21:38:15 2018
@@ -196,9 +196,16 @@ public class ThroughputController
     @Override
     public boolean isDone() {
         return subControllersAndSamplers.isEmpty()
-                || (getStyle() == BYNUMBER
-                && getExecutions() >= getMaxThroughputAsInt()
-                && current >= getSubControllers().size());
+                || 
+                (
+                        (getStyle() == BYNUMBER
+                            && (
+                            (getExecutions() >= getMaxThroughputAsInt()
+                            && current >= getSubControllers().size())
+                            || (getMaxThroughputAsInt() == 0)))
+                        || (getStyle() == BYPERCENT
+                            && getPercentThroughputAsFloat() == 0.0f)
+                        );
     }
 
     @Override

Modified: jmeter/trunk/test/src/org/apache/jmeter/control/ThroughputControllerSpec.groovy
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/control/ThroughputControllerSpec.groovy?rev=1822704&r1=1822703&r2=1822704&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/control/ThroughputControllerSpec.groovy (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/control/ThroughputControllerSpec.groovy Tue Jan 30 21:38:15 2018
@@ -80,6 +80,64 @@ class ThroughputControllerSpec extends S
             sut.testEnded()
     }
 
+    /**
+     * <pre>
+     *   - innerLoop
+     *     - ThroughputController (sut)
+     *        - sampler one
+     *        - sampler two
+     * </pre>
+     */
+    def "0 maxThroughput does not run any sampler inside the TC and does not cause StackOverFlowError"() {
+        given:
+        sut.setStyle(ThroughputController.BYNUMBER)
+        sut.setMaxThroughput(0)
+
+        LoopController innerLoop = new LoopController()
+        innerLoop.setLoops(10000)
+        innerLoop.addTestElement(sut)
+        innerLoop.addIterationListener(sut)
+        innerLoop.initialize()
+        innerLoop.setRunningVersion(true)
+        sut.testStarted()
+        sut.setRunningVersion(true)
+
+        when:
+            innerLoop.next() == null;
+            innerLoop.next() == null
+        then:
+            sut.testEnded()
+    }
+    
+    /**
+     * <pre>
+     *   - innerLoop
+     *     - ThroughputController (sut)
+     *        - sampler one
+     *        - sampler two
+     * </pre>
+     */
+    def "0.0 percentThroughput does not run any sampler inside the TC and does not cause StackOverFlowError"() {
+        given:
+        sut.setStyle(ThroughputController.BYPERCENT)
+        sut.setPercentThroughput("0.0")
+
+        LoopController innerLoop = new LoopController()
+        innerLoop.setLoops(10000)
+        innerLoop.addTestElement(sut)
+        innerLoop.addIterationListener(sut)
+        innerLoop.initialize()
+        innerLoop.setRunningVersion(true)
+        sut.testStarted()
+        sut.setRunningVersion(true)
+
+        when:
+            innerLoop.next() == null;
+            innerLoop.next() == null
+        then:
+            sut.testEnded()
+    }
+
     def "33.33% will run all the samplers inside the TC every 3 iterations"() {
         given:
             sut.setStyle(ThroughputController.BYPERCENT)

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1822704&r1=1822703&r2=1822704&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Tue Jan 30 21:38:15 2018
@@ -339,6 +339,7 @@ itself does not have to be edited anymor
     <li><bug>61556</bug>Clarify in documentation performance impacts of <code>${}</code> var usage in IfController and groovy. Contributed by Justin McCartney (be_strew at yahoo.co.uk)</li>
     <li><bug>61713</bug>Test Fragment has option to Change Controller and Insert Parent. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
     <li><bug>61965</bug>Module and Include Controller should not allow to add meaningless elements in their context.</li>
+    <li><bug>62062</bug>ThroughputController: StackOverFlowError triggered when throughput=0 (Total Executions or Percentage Executions) Partly implemented by Artem Fedorov (artem.fedorov at blazemeter.com) and contributed by BlazeMeter Ltd.</li>
 </ul>
 
 <h3>Listeners</h3>