Bug 33559

Summary: RunOnce inside Runtime-Controller runs more than once
Product: JMeter - Now in Github Reporter: Matthias Kerkhoff <make>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: Nightly (Please specify date)   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Matthias Kerkhoff 2005-02-14 14:28:21 UTC
Below is a fragment of our jmeter test tree used for functional testing of a 
webapp:

thread group
 |
 +- Runtime controller
     |
     +- Run once controller
         |
         +- Http request sampler
         |
         +- While Controller
         |
         .. more stuff here


The controllers below the RunOnce controller take some time to execute, around 
60 seconds. The while controller basically polls a status page to check the 
progress of some work unit triggered earlier in the test.

There are some special cases in which such progress may not happen and the test 
should fail. The easiest way for us to deceide if a test should fail would be a 
timeout. If that timeout is reached and the status page still does not contain 
a certain message, the test should fail.

Therefore I set the timeout in the Runtime controller, 120 seconds for example. 
The RunOnce controller was intended to ensure that the subtree below it is 
actually executed only once which is very important for a test scenario. 

While checking the result tree I can see one of two behaviours. With a small 
timeout, the runtime controller will stop executing the subtree after the given 
runtime is over. That's fine. If the timeout is set to a larger value jmeter 
behaves different. After the first iteration, if there is runtime left, jmeter 
will just re-execute the tree below the runonce controller. 

Did I mis-understood the documentation of the run-once controller or is this a 
bug? 

Beside that - is there a better way to set a maximum execution time on a test 
tree fragment?

(I'm using the nightly build 20050118)
Comment 1 Sebb 2005-03-12 03:49:10 UTC
Can you perhaps swap the Run Once and the Runtime Controllers around?
Comment 2 Sebb 2005-03-13 20:13:16 UTC
Did some tests, and found various problems:

- OnceOnly did not set isdone, so could be run up again
- RunTime did not reset start time for later calls, and would cause stack
overflow if its children had all finished.

Fixes applied to 2.0 branch
Comment 3 Sebb 2005-03-14 00:31:17 UTC
Unfortunately the fix to the Once Only controller changed its behaviour in other
situations (*), so it has had to be backed out.

This means that the Once Only Controller does not current work properly when
present as the child of the RunTime Controller, so re-opening the call.

However, the Run-Time Controller does seem to work correctly as the child of the
Once Only Controller, so that may help in your testing. However, note that the
RunTime Controller will continue to run until the time limit has been reached,
so it acts as the minimum run-time, rather than the maximum.

(*) The OnceOnly Controller can run more than once in a test, if it is the child
of a loop controller that is itself run more than once - this is documented in
the User Manual
Comment 4 Sebb 2005-03-17 01:37:38 UTC
Fix checked into branch 2.0 so RunTime now behaves like Loop Controller - i.e.
OnceOnly children are run once per loop.

Also fixed calculation of run-time for subsequent loops.

[Leaving call open for time being]
Comment 5 The ASF infrastructure team 2022-09-24 20:37:34 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/1509