Created attachment 31332 [details] Testplan to reproduce I got a Testplan that contains a WhileController below an IfController. The condition of the IfController is false and the WhileController uses the __javaScript function to evaluate the content of a variable. If the variable is not set (for example because it's set below the IfController before the WhileController) JMeter logs the line WARN - jmeter.control.GenericController: StackOverflowError detected The Error doesn't bubble up but it slows down test execution. Furthermore it's strange something below the IfController is executed/evaluated even if the condition of the if is false.
After some debugging, the problem seems to be that the WhileController always returns the one contained sampler on nextIsNull(). Therefore nextIsAController always returns the Sampler too and never null; (Though nextIsAController can't ever return null but at the end of the controller) So because the WhileLoop never returns null reInitializeSubController will be called recursivly until the SOE is thrown. But the first thing is that the WhileController.next() shouldn't have been called in the first place. I'll try to create a patch and see what you think of it.
Created attachment 31333 [details] Proposed Patch Patch for IfController so that child elements are not "touched" if the condition is false. + UnitTests
The proposed patch makes the IfController return null if the condition is false on the first invocation of it's next method. This should prevent Jmeter to dive into the children of the IfController and call their next method. So child-controllers which always return an element and never null (e.g. WhileController with condition that is always true) won't result in a StackOverflow. The issue may persist if the whileController is supposed to loop forever and and the if controller's condition is true.
Although summary of 52496 may not be clear, it is the exact duplicate, see bugs already marked as duplicate *** This bug has been marked as a duplicate of bug 52496 ***
*** Bug 52496 has been marked as a duplicate of this bug. ***
*** Bug 53768 has been marked as a duplicate of this bug. ***
Date: Sun Oct 12 15:30:39 2014 New Revision: 1631189 URL: http://svn.apache.org/r1631189 Log: Bug 56160 - StackOverflowError when using WhileController within IfController Bugzilla Id: 56160 Modified: jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java jmeter/trunk/src/core/org/apache/jmeter/control/IfController.java jmeter/trunk/src/core/org/apache/jmeter/control/TransactionController.java jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContext.java jmeter/trunk/test/src/org/apache/jmeter/control/TestIfController.java jmeter/trunk/xdocs/changes.xml
*** Bug 52618 has been marked as a duplicate of this bug. ***
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3320