JMeter-WebSocketSampler icon indicating copy to clipboard operation
JMeter-WebSocketSampler copied to clipboard

Concurrent Modification

Open MenezesDNS opened this issue 11 years ago • 7 comments

I'm getting the following stack trace while creating a test with 50 threads:

  • Unexpected error: null java.util.LinkedList$ListItr.checkForComodification(Unknown Source) java.util.LinkedList$ListItr.next(Unknown Source) JMeter.plugins.functional.samplers.websocket.ServiceSocket.getResponseMessage(ServiceSocket.java:116) JMeter.plugins.functional.samplers.websocket.WebSocketSampler.sample(WebSocketSampler.java:154) org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:429) org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257) java.lang.Thread.run(Unknown Source)

Is this expected?

MenezesDNS avatar Apr 11 '14 21:04 MenezesDNS

There is a concurrency between the onMessage() on ServiceSocket and the sample() on WebSocketSampler. See log lines below:

  • Received message #2 (3 bytes) - Leaving streaming connection open ; didn't match any pattern

It looks like the code lines below are not necessary (per your comments) but if they're I believe you should create a synchronized(this) block as the onMessage() has a sync block on parent (which is the sampler object).

//If no response is received set code 204; actually not used...needs to do something else if (socket.getResponseMessage() == null || socket.getResponseMessage().isEmpty()) { sampleResult.setResponseCode("204"); }

MenezesDNS avatar May 08 '14 01:05 MenezesDNS

So just replace one line in the ServiceSocket.java:

protected Deque<String> responeBacklog = new LinkedList<String>(); with this line:

Queue<String> responeBacklog = new ConcurrentLinkedQueue<String>(); It solved this problem :)

v0devil avatar Jun 13 '14 13:06 v0devil

It works perfectly! Thank you so much!

danhnguyen0902 avatar Dec 25 '15 21:12 danhnguyen0902

In case anyone finds this and just needs the updated jar, you can find it in the pull request at https://github.com/maciejzaleski/JMeter-WebSocketSampler/pull/64

camhart avatar Mar 17 '17 16:03 camhart

I need updated websocket sampler with this jar.please anyone can provide me the link.need it asap.

madans009 avatar Nov 07 '17 18:11 madans009

i AM also getting this error:

Unexpected error: null java.util.LinkedList$ListItr.checkForComodification(Unknown Source) java.util.LinkedList$ListItr.next(Unknown Source) JMeter.plugins.functional.samplers.websocket.ServiceSocket.getResponseMessage(ServiceSocket.java:116) JMeter.plugins.functional.samplers.websocket.WebSocketSampler.sample(WebSocketSampler.java:154) org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:429) org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257) java.lang.Thread.run(Unknown Source)

madans009 avatar Nov 07 '17 19:11 madans009

At the time I wrote this report I proceeded with silently ignoring the exception (simple try/catch block). If I recall it correctly, it was safe to do that in my case as the data structure presenting the concurrency issue was only used to garther the test results for presentation in the Jmeter UI. It was safe for me to ignore it as I was mostly focused in driving load and I could afford missing one or other individual test response.

I unfortunately do not have the code anymore.

MenezesDNS avatar Nov 07 '17 21:11 MenezesDNS