Concurrent Modification
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?
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"); }
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 :)
It works perfectly! Thank you so much!
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
I need updated websocket sampler with this jar.please anyone can provide me the link.need it asap.
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)
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.