Forum Discussion

arunpanjala's avatar
arunpanjala
Occasional Contributor
15 years ago

Multi-threading in SoapUI Mock Service

Hello Friends,

I'm trying to mock a game management system using SoapUI Mock service. I'm concurrently logging multiple players but the requests are failing due to concurrency exception. Does SoapUI handle concurrent users efficiently? Please let me know if there are any options out of the box which I should configure to address these concurrency modification exceptions.

Thanks,
Arun

7 Replies

  • arunpanjala's avatar
    arunpanjala
    Occasional Contributor
    Hi Ole,

    Thanks for the quick response. I'm using SoapUI Pro 3.0.1 version. Will these nightly build scripts (I see they are for 3.0.2) work for this version? Please let me know.

    Thanks,
    Arun
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Arun,

    yes, you should have no problems upgrading. You can install to a different directory so you have both installations to play with (and compare)..

    Let us know how it goes?

    regards,

    /Ole
    eviware.com
  • arunpanjala's avatar
    arunpanjala
    Occasional Contributor
    Hi Ole,

    No Luck 

    I still get the same exception. Here is the exception message I get in Soap UI


     
       
          Server
          java.util.ConcurrentModificationException
       

     




    Based on your suggestion I downloaded "soapUI-Pro-x32-3_0_2.exe" from the nightly build site and installed it and tested the Mock service once again. But still getting the same exception. Is this the patch you are talking about? Or do I need to use any other file from the nightly build folder?

    I have also put the code to handle synchronization of threads. But its not working either. Do you have any pointers to this?

    Thanks,
    Arun
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Arun,

    can you check the error-log tab in soapUI to see if you are getting any extended information there?

    Is there any way I could try to reproduce this? ie could you attach your project file ?

    regards,

    /Ole
    eviware.com
  • arunpanjala's avatar
    arunpanjala
    Occasional Contributor
    Hi Ole,

    Here is the complete information on this issue. I have attached the following files which will help you to reproduce the error.

    “Gaming Simulator.xml” : SoapUI project document with Mock Service code along with a  test case to test the load

    “Message Log of Mock Service.JPG” : This is the exception we are encountering while testing the load on Mock Service.

    “Login-Logout Screenshot.JPG”        :          Even though we are using synchronized block of code, multiple threads are executing the synchronized code simultaneously. We have included log.info messages to trace this and as you can see in the bottom of the picture, “Login inside” string is displayed twice continuously which makes it evident that concurrency is not handled properly even through we are using synchronized block of code

    "Error Log.txt" : Has the stack trace of the exception we are getting in "error log"

    Thank you for your support and any pointers to resolve this issue would be of great help!

    Thanks,
    Arun
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hello,

    Each script will run as a separate Script object, so that synchronization won't work. Instead each script should synchronize on a shared object. Try this instead:

    Add a Setup Script to the LoadTest containing this:


    context.lock = new Object()


    Then, modify your Groovy Script to the following:


    //The method itself is not synchronized
    def String callLogin()
    {
    //Use the shared object created in the Setup Script for synchronization
    synchronized(context.LoadTestContext.lock)
    {
    log.info 'Login inside'
    ...
    }
    }


    This should work as intended. Good luck!

    Regards,
    Dain
    eviware.com