Summary: | Last_Sample_Ok along with other controllers doesnt work correctly when the threadgroup has multiple loops | ||
---|---|---|---|
Product: | JMeter - Now in Github | Reporter: | Deepak Shetty <shettyd> |
Component: | Main | Assignee: | JMeter issues mailing list <issues> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | p.mouawad |
Priority: | P1 | ||
Version: | 2.5 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
Attachments: |
Simplified test plan showing the issue
Proposal patch Shows the issue CSV file to use with Regression-Script.jmx. Fix to the issue where If Controller generates additional samples for children Transaction Controller inside when condition is false |
Created attachment 26151 [details]
Proposal patch
Thanks for your report and test script. This bug comes from a Simple controller's index which is not reinitialized on loop 2 (the next is sample 4 - not the sample 3) Solution: when "If Controller" breaks tree execution (after Sample 3 fails) run a reinitialization indexes on sub-controllers. in attachment, a proposal patch. @sebb: have you a comment before I commit the patch? Patch looks fine to me, except that I think the method reInitializeSubController() should be protected rather than public. [It can always be made public later if it proves necessary.] Thanks; fixed in SVN (and next nightly build): URL: http://svn.apache.org/viewvc?rev=1021512&view=rev Log: Bug 50032 - Last_Sample_Ok along with other controllers doesnt work correctly when the threadgroup has multiple loops Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/IfController.java jakarta/jmeter/trunk/test/src/org/apache/jmeter/control/TestIfController.java URL: http://svn.apache.org/viewvc?rev=1021514&view=rev Modified: jakarta/jmeter/trunk/xdocs/changes.xml URL: http://svn.apache.org/viewvc?rev=1061679&view=rev Log: No need to return a value (improving patch Bug 50032) Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/IfController.java Hello, This patch introduced a regression on IfController. Attached is a scenario that shows how an Infinite Loop will occur when a IfController contains a TransactionController. If condition evaluates to false, reInitializeSubController will loop infinitely. I don't know if this reopening is a duplicate of 50618 but maybe another manifestation of the regression. Regards Philippe Mouawad Created attachment 27486 [details]
Shows the issue
Created attachment 27487 [details]
CSV file to use with Regression-Script.jmx.
Hello, There is another issue with patch, it's that it generates additional samples for transactions inside IfCOntroller due to the call to nextIsAController() inside reInitializeSubController. For example when line in CSV is equal to 0, I get in "View Results Tree" calls to: - s3-createAddressAndHousing - S3-createLegalEntityAddress although sampler inside these are not executed. Regards Philippe (In reply to comment #6) Thanks. Fixed. URL: http://svn.apache.org/viewvc?rev=1170388&view=rev Log: If Controller - Fixed a regression introduce by bug 50032 See: https://issues.apache.org/bugzilla/show_bug.cgi?id=50032#c6 and https://issues.apache.org/bugzilla/show_bug.cgi?id=50618#c28 Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java jakarta/jmeter/trunk/xdocs/changes.xml Thank you for applying. Maybe a note should be added in Known issues regarding the incomplete fix of this isssue: - Currently it generates additional samples for transactions inside IfCOntroller due to the call to nextIsAController() inside reInitializeSubController. Even if sampler are not run. I don't know if you close this issue and open another bug or you keep this one opened. Regards Philippe URL: http://svn.apache.org/viewvc?rev=1170707&view=rev Log: Add two knows issues : bug 50032 and bug 50618 Modified: jakarta/jmeter/trunk/xdocs/changes.xml Created attachment 27519 [details]
Fix to the issue where If Controller generates additional samples for children Transaction Controller inside when condition is false
Hello,
Here is a fix to the known issue related to this bug:
-If Controller generates additional samples for children Transaction Controller inside when condition is false.
Here is how it works, once a thread enters reInitializeSubController() it flags the JMeterThreadContext if it's the first Parent.
In TransactionController listeners will not be notified that a sample occured since it didn't .
Once the first Parent has finished reinitializing, it unsets the flag in finally.
I tested with attached JMX and it works.
Regards
Philippe
Philippe, your patch don't respect code style used in JMeter. == No good == } finally { == Good == } finally { ========== == No good == if(isReinitializingSubControllers) { isReinitializingSubControllers = false; } else { log.warn("Unsetting while flag is not true"); } == Good == if (isReinitializingSubControllers) { // please note: one space before left parenthesis isReinitializingSubControllers = false; } else { log.warn("Unsetting while flag is not true"); } ======= Comments on source code don't need have all characters in uppercase ======= "@see" must follow by a classname, not a "ISSUE" keyword. Please respect code style convention in JMeter for next submissions. Thanks. Thanks for patch (even if it didn't follow code style :)) Applied. Now, I close the bug. Thanks Phillippe. URL: http://svn.apache.org/viewvc?rev=1171999&view=rev Log: Bug 50032 - Fixed a new regression introduced by bug 50032 when Transaction Controller is a child of If Controller Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/TransactionController.java jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContext.java jakarta/jmeter/trunk/xdocs/changes.xml I am sorry for not respecting, I missed it. I will take care next time, anyway thanks for taking it as is. Regards Philippe. This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2405 |
Created attachment 26105 [details] Simplified test plan showing the issue if the test plan is Thread Group (Thread = 1 , Loop =2) +Sample1 +If Controller (${JMeterThread.last_sample_ok}) ++Sample2 ++Sample3 (always fails) ++Sample4 (always fails) Then the test plan executes correctly (i.e. Result is Sample1, Sample2, Sample3(failed) ,Sample1, Sample2, Sample3(failed) However if now we add a Simple Controller so that the plan is Thread Group (Thread = 1 , Loop =2) +Sample1 +If Controller (${JMeterThread.last_sample_ok}) ++Sample2 ++Simple Controller +++Sample3 (always fails) +++Sample4 (always fails) Then the test plan executes incorrectly(i.e. Result is Sample1, Sample2, Sample3(failed) ,Sample1, Sample2, Sample4(failed) The only workaround I can see is to not have the simple controller (but other controllers like the IF will similarly impact the behavior so this isnt very viable)