Summary: | JSR223 sampler SampleResult.setIgnore() caches script even when unchecked caching | ||
---|---|---|---|
Product: | JMeter - Now in Github | Reporter: | Leon Proskurov <leon.proskurov> |
Component: | Main | Assignee: | JMeter issues mailing list <issues> |
Status: | RESOLVED FIXED | ||
Severity: | regression | CC: | leon.proskurov |
Priority: | P2 | Keywords: | FixedInTrunk, PatchAvailable, Regression |
Version: | 5.4.1 | ||
Target Milestone: | JMETER_5.5 | ||
Hardware: | PC | ||
OS: | All | ||
Attachments: |
screenshot
test scenario example SampleResult#setIgnore in loop controller behaves strangely Reset pack to initial state for ignored samples |
Can you post a minimal test plan that exhibits this behaviour? Why are you using ${...} inside the JSR223 script? Created attachment 38030 [details]
test scenario example
The "Create locations JSR223 sampler" will be executed inside a loop controller several times.
once the "Cache compiled script..." is enabled, the values do not change, thus it is unchecked and values differ.
Once I add "SampleResult.setIgnore()" to the sampler, the values do not change again
Could you please attach a minimal testplan as XML instead of an image? That way, I can re-run exactly what you head, instead of guessing all those elements and their contents :) And it would be great, if it doesn't contain any third party plugins. It helps easy reproduction. Created attachment 38031 [details]
SampleResult#setIgnore in loop controller behaves strangely
I think, this is a minimal test plan, that can reproduce the described behaviour.
Although this is not a caching problem inside the JSR223 sampler, it is for sure a problem. As soon, as we call SampleResult#setIgnore inside a JSR223 sampler inside a loop controller, the JSR223 sampler gets a stale script put into its script editor. So even, if it doesn't cache its script, it looks like it is cached. The script gets updated, once the thread starts a new iteration (not the loop iteration!).
Created attachment 38032 [details]
Reset pack to initial state for ignored samples
The problem seems to be, that the call to `compiler.done(pack)` was missing, when the sampler was to be ignored. With this patch, the script gets filled with the correct values on each iteration of the loop.
@Leon, could you test next nightly or build from trunk and report, whether it fixes your issue? commit 5f1995de244986c820ed47028ceedf9167004673 AuthorDate: Sat Oct 16 13:33:21 2021 +0200 Always call compiler.done(pack) on sampler when it is finished When the sampler set sample to ignore, compiler.done(pack) was not called, which led to strange effects, as the thread loop thought, it was already initialized on the next iteration and did not set the new values before the next sample. Bugzilla Id: 65569 --- src/core/src/main/java/org/apache/jmeter/threads/JMeterThread.java | 1 + 1 file changed, 1 insertion(+) Closing, as no further information from user probably means, that it works now. This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/5575 |
Created attachment 38029 [details] screenshot Unchecking "Cache compiled script if available" and adding "SampleResult.setIgnore()" to groovy script will still cache and not update values (inside loop controller). Commenting out "SampleResult.setIgnore()" will cause no caching to work as expected (but will report to listeners).