You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Nuwan Galkissa Mudalige <nm...@virtusa.com.INVALID> on 2022/03/01 03:06:10 UTC

While Controller variable doesn't reset and not execute 2nd Iteration and later when it is running as Child under Parallel controller

Hi Team,

I have two different http requests which run parallelly and will be stopped when expectation is met. Here, I used bzm - Parallel controller (Item Publish - Parallel, pls refer the image) to execute those are in parallel and use While controller as child of it to execute until the expectation is met. JSR223 sample is used to reset the While variable for next loop.

This While setup is successfully executed for any number of iterations without using Parallel controller. But when that setup put under the Parallel controller, first iteration works fine for both requests but from 2nd iteration onwards it doesn't get executed and throw the below error.

Please refer the parent/child setup and error below and please share your thoughts to resolve this case. Thank you !!

[cid:image001.png@01D82CEF.0DA82980]



2022-03-01 08:44:56,197 INFO o.a.j.t.JMeterThread: Thread finished: org.apache.jmeter.threads.JMeterThread@6f32f9a0<ma...@6f32f9a0> - Item Publish - Parallel - Trans B - Item 2 Publish
2022-03-01 08:44:56,197 ERROR o.a.j.t.JMeterThread: Test failed!
java.lang.NullPointerException: Cannot invoke "org.apache.jmeter.threads.JMeterVariables.getObject(String)" because "threadVars" is null
at org.apache.jmeter.control.TransactionController.notifyListeners(TransactionController.java:285) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.TransactionController.nextWithoutTransactionSampler(TransactionController.java:223) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.TransactionController.next(TransactionController.java:135) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:225) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.TransactionController.nextIsAController(TransactionController.java:173) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.GenericController.next(GenericController.java:175) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.TransactionController.nextWithoutTransactionSampler(TransactionController.java:205) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.TransactionController.next(TransactionController.java:135) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:222) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.GenericController.next(GenericController.java:175) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.LoopController.next(LoopController.java:134) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:291) [ApacheJMeter_core.jar:5.4.1]
at com.blazemeter.jmeter.controller.JMeterThreadParallel.run(JMeterThreadParallel.java:61) [jmeter-parallel-0.11.jar:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
at java.lang.Thread.run(Thread.java:833) [?:?]

Regards,
Nuwan

________________________________

"Virtusa is a worldwide provider of digital business strategy, digital engineering, and information technology (IT) services and solutions, serving Global 2000 companies across multiple industries. We help clients change, disrupt, and unlock new value with unmatched speed."

________________________________

This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.

________________________________

RE: While Controller variable doesn't reset and not execute 2nd Iteration and later when it is running as Child under Parallel controller

Posted by Nuwan Galkissa Mudalige <nm...@virtusa.com.INVALID>.
Thanks for your response Dmitri.
Without Parallel controller they will run as sequential order. But in real world they are running in parallelly. So removing Parallel controller, I won't be able to simulate the real world scenario. As you mentioned if that setup doesn't work at all, can you suggest alternatives to keep them parallel running ?

Regards,
Nuwan

From: Dmitri T <gl...@live.com>
Sent: Tuesday, March 1, 2022 1:18 AM
To: Nuwan Galkissa Mudalige <nm...@virtusa.com>; user@jmeter.apache.org; felix.schumacher@internetallee.de
Subject: Re: While Controller variable doesn't reset and not execute 2nd Iteration and later when it is running as Child under Parallel controller

Do you really understand what the Parallel Controller <https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.blazemeter.com%2Fblog%2Fhow-to-use-the-parallel-controller-in-jmeter&data=04%7C01%7Cnmudalige%40virtusa.com%7C06fe432ee7784698205908d9fb4b4e65%7C0d85160c589944caacc8db1501b993b6%7C0%7C0%7C637817123266014238%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=0vWI5uQaIwhZ3%2B5V3NUAqaSh8GKL7FnekVJrsV6fjsc%3D&reserved=0> does? It appeared few years ago and it is not required for implementing concurrency as JMeter is being used for load testing for 20+ years without this plugin.

It executes its children in parallel threads and your test "design" assumes that first you "reset" something using a JSR223 Sampler and then you're running a while loop.

With Parallel Controller both JSR223 Sampler and the While Controller are being executed at the same time hence the "variable" isn't getting "reset" because the Sampler and the While Controller are running in parallel threads and even if your Groovy code is very fast JMeter Variables are thread local<https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fjmeter.apache.org%2Fusermanual%2Ffunctions.html&data=04%7C01%7Cnmudalige%40virtusa.com%7C06fe432ee7784698205908d9fb4b4e65%7C0d85160c589944caacc8db1501b993b6%7C0%7C0%7C637817123266014238%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=d8y5BeeylLEp%2B3F5xFomWFPRUZOOHELYOYj9eb82MYM%3D&reserved=0> and While Controller won't be able to access it.

Just remove the Parallel Controllers as you don't need them at all in this case.
On 3/1/2022 4:06 AM, Nuwan Galkissa Mudalige wrote:
Hi Team,

I have two different http requests which run parallelly and will be stopped when expectation is met. Here, I used bzm - Parallel controller (Item Publish - Parallel, pls refer the image) to execute those are in parallel and use While controller as child of it to execute until the expectation is met. JSR223 sample is used to reset the While variable for next loop.

This While setup is successfully executed for any number of iterations without using Parallel controller. But when that setup put under the Parallel controller, first iteration works fine for both requests but from 2nd iteration onwards it doesn't get executed and throw the below error.

Please refer the parent/child setup and error below and please share your thoughts to resolve this case. Thank you !!

[cid:image001.png@01D82D47.8A6F0850]



2022-03-01 08:44:56,197 INFO o.a.j.t.JMeterThread: Thread finished: org.apache.jmeter.threads.JMeterThread@6f32f9a0<ma...@6f32f9a0> - Item Publish - Parallel - Trans B - Item 2 Publish
2022-03-01 08:44:56,197 ERROR o.a.j.t.JMeterThread: Test failed!
java.lang.NullPointerException: Cannot invoke "org.apache.jmeter.threads.JMeterVariables.getObject(String)" because "threadVars" is null
at org.apache.jmeter.control.TransactionController.notifyListeners(TransactionController.java:285) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.TransactionController.nextWithoutTransactionSampler(TransactionController.java:223) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.TransactionController.next(TransactionController.java:135) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:225) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.TransactionController.nextIsAController(TransactionController.java:173) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.GenericController.next(GenericController.java:175) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.TransactionController.nextWithoutTransactionSampler(TransactionController.java:205) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.TransactionController.next(TransactionController.java:135) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:222) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.GenericController.next(GenericController.java:175) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.control.LoopController.next(LoopController.java:134) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:291) [ApacheJMeter_core.jar:5.4.1]
at com.blazemeter.jmeter.controller.JMeterThreadParallel.run(JMeterThreadParallel.java:61) [jmeter-parallel-0.11.jar:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
at java.lang.Thread.run(Thread.java:833) [?:?]

Regards,
Nuwan

________________________________

"Virtusa is a worldwide provider of digital business strategy, digital engineering, and information technology (IT) services and solutions, serving Global 2000 companies across multiple industries. We help clients change, disrupt, and unlock new value with unmatched speed."

________________________________

This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.

________________________________

________________________________

"Virtusa is a worldwide provider of digital business strategy, digital engineering, and information technology (IT) services and solutions, serving Global 2000 companies across multiple industries. We help clients change, disrupt, and unlock new value with unmatched speed."

________________________________

This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.

________________________________

Re: While Controller variable doesn't reset and not execute 2nd Iteration and later when it is running as Child under Parallel controller

Posted by Dmitri T <gl...@live.com>.
Do you really understand what the Parallel Controller 
<https://www.blazemeter.com/blog/how-to-use-the-parallel-controller-in-jmeter>does? 
It appeared few years ago and it is not required for implementing 
concurrency as JMeter is being used for load testing for 20+ years 
without this plugin.

It *executes its children in parallel threads* and your test "design" 
assumes that first you "reset" something using a JSR223 Sampler and then 
you're running a while loop.

With Parallel Controller both JSR223 Sampler and the While Controller 
are being executed at the same time hence the "variable" isn't getting 
"reset" because the Sampler and the While Controller are running in 
parallel threads and even if your Groovy code is very fast JMeter 
Variables are thread local 
<https://jmeter.apache.org/usermanual/functions.html> and While 
Controller won't be able to access it.

Just remove the Parallel Controllers as you don't need them at all in 
this case.

On 3/1/2022 4:06 AM, Nuwan Galkissa Mudalige wrote:
>
> Hi Team,
>
> I have two different http requests which run parallelly and will be 
> stopped when expectation is met. Here, I used bzm – Parallel 
> controller (Item Publish – Parallel, pls refer the image) to execute 
> those are in parallel and use While controller as child of it to 
> execute until the expectation is met. JSR223 sample is used to reset 
> the While variable for next loop.
>
> This While setup is successfully executed for any number of iterations 
> without using Parallel controller. But when that setup put under the 
> Parallel controller, first iteration works fine for both requests but 
> from 2^nd iteration onwards it doesn’t get executed and throw the 
> below error.
>
> Please refer the parent/child setup and error below and please share 
> your thoughts to resolve this case. Thank you !!
>
> 2022-03-01 08:44:56,197 INFO o.a.j.t.JMeterThread: Thread finished: 
> org.apache.jmeter.threads.JMeterThread@6f32f9a0 – Item Publish - 
> Parallel – Trans B – Item 2 Publish
>
> 2022-03-01 08:44:56,197 ERROR o.a.j.t.JMeterThread: Test failed!
>
> java.lang.NullPointerException: Cannot invoke 
> "org.apache.jmeter.threads.JMeterVariables.getObject(String)" because 
> "threadVars" is null
>
> at 
> org.apache.jmeter.control.TransactionController.notifyListeners(TransactionController.java:285) 
> ~[ApacheJMeter_core.jar:5.4.1]
>
> at 
> org.apache.jmeter.control.TransactionController.nextWithoutTransactionSampler(TransactionController.java:223) 
> ~[ApacheJMeter_core.jar:5.4.1]
>
> at 
> org.apache.jmeter.control.TransactionController.next(TransactionController.java:135) 
> ~[ApacheJMeter_core.jar:5.4.1]
>
> at 
> org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:225) 
> ~[ApacheJMeter_core.jar:5.4.1]
>
> at 
> org.apache.jmeter.control.TransactionController.nextIsAController(TransactionController.java:173) 
> ~[ApacheJMeter_core.jar:5.4.1]
>
> at 
> org.apache.jmeter.control.GenericController.next(GenericController.java:175) 
> ~[ApacheJMeter_core.jar:5.4.1]
>
> at 
> org.apache.jmeter.control.TransactionController.nextWithoutTransactionSampler(TransactionController.java:205) 
> ~[ApacheJMeter_core.jar:5.4.1]
>
> at 
> org.apache.jmeter.control.TransactionController.next(TransactionController.java:135) 
> ~[ApacheJMeter_core.jar:5.4.1]
>
> at 
> org.apache.jmeter.control.GenericController.nextIsAController(GenericController.java:222) 
> ~[ApacheJMeter_core.jar:5.4.1]
>
> at 
> org.apache.jmeter.control.GenericController.next(GenericController.java:175) 
> ~[ApacheJMeter_core.jar:5.4.1]
>
> at 
> org.apache.jmeter.control.LoopController.next(LoopController.java:134) 
> ~[ApacheJMeter_core.jar:5.4.1]
>
> at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:291) 
> [ApacheJMeter_core.jar:5.4.1]
>
> at 
> com.blazemeter.jmeter.controller.JMeterThreadParallel.run(JMeterThreadParallel.java:61) 
> [jmeter-parallel-0.11.jar:?]
>
> at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) 
> [?:?]
>
> at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
>
> at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) 
> [?:?]
>
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) 
> [?:?]
>
> at java.lang.Thread.run(Thread.java:833) [?:?]
>
> Regards,
>
> Nuwan
>
>
> ------------------------------------------------------------------------
>
> "Virtusa is a worldwide provider of digital business strategy, digital 
> engineering, and information technology (IT) services and solutions, 
> serving Global 2000 companies across multiple industries. We help 
> clients change, disrupt, and unlock new value with unmatched speed."
>
> ------------------------------------------------------------------------
>
> This message, including any attachments, contains confidential 
> information intended for a specific individual and purpose, and is 
> intended for the addressee only. Any unauthorized disclosure, use, 
> dissemination, copying, or distribution of this message or any of its 
> attachments or the information contained in this e-mail, or the taking 
> of any action based on it, is strictly prohibited. If you are not the 
> intended recipient, please notify the sender immediately by return 
> e-mail and delete this message.
>
> ------------------------------------------------------------------------