'Jmeter - All threads other than current thread wait

I am new to Jmeter and I have been struggling with my test plan.

Test plan steps:

  • Enters the site
  • Creates multiple wish lists (like the wish list on amazon)
  • In the wish list dashboard the order of the list is constantly updated based on the most recently -edited list on the top of the page
  • I have multiple threads entering this dashboard and editing the wish lists
  • I am using multiple if statements to validate the position of the wish list (based on name) the current thread wants to modify.

Problem:

  • The problem is that after that if statement when I try to click edit (POST request) on the desired wish list associated with the current thread the page crashes
  • The reason behind the crash is a race condition. Before I can post the position of the page, the location changes (another thread has created or modified a wish list)
  • I have tried using Critical Section Control but that will not work be because the other thread can be working on editing the wish list which can change the order on the dashboard.

Question:

  • Is there a way on Jmeter where I can pause the all the thread other than the current thread when I am at the Dashboard Post request?


Solution 1:[1]

  1. If your application should allow concurrent modification of the same wish list by different users - it's an application bug which needs to be resolved
  2. If your application doesn't allow concurrent modification of the same wish list by different users - your test is badly designed, you need to amend it and ensure that each thread (virtual user) is using different wish list. There is __threadNum() function which allows getting the ID of current thread (virtual user), you can use this information in order to distinguish users/threads
  3. If your scenario is more complex you can consider using i.e. Inter-Thread Communication Plugin, you can implement whatever scenario of IPC you want using it. Inter-Thread Communication Plugin can be installed using JMeter Plugins Manager

Solution 2:[2]

You can use the Critical Section Controller to execute a single or multiple requests in a thread by a single thread in a thread group.Critical Section Controller takes control over a single JVM. Hence it is not suitable if you are in distributed testing.

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitri T
Solution 2 Janesh Kodikara