The read sampler does not capture the message.

Issue #246 closed
Zhang Zhao created an issue

I was running a load test against a WebSocket to measure the latency between publishers and subscribers. I had 3 thread groups in my test plan.

  1. Setup (setUp Thread Group) to make sure both publishers and subscribers are connected to the WebSocket.

    1. a request-response sampler to have the publisher connect to the WebSocket.
    2. another request-response sampler to have the publisher create a session for subscribers to join

      1. Added a JSR223 PostProcessor to cache the connection so that the following publisher thread group can restore the connection to send messages.
    3. A request-response sampler to have the subscriber connect to the WebSocket by setup a new connection. (publisher and subscriber have different paths)

    4. A write sampler to subscribe to the session that was created by the publisher

      1. Added a JSR223 PostProcessor to cache the connection so that the following Subscriber thread group can pick up the connection to read messages.
  2. Publisher (Thread Group)

    1. Single Write Sampler to send messages out
  3. Subscriber (Thread Group)

    1. Single Read Sampler inside a Loop Controller to read messages

Everything worked as expected until the last read sampler in the Subscriber Thread Group. It returned WebSocket I/O read timed out error even though I increased the timeout to 15s. I am not sure why the read sampler could not capture any messages. I can see the read sampler did connect to the correct URL using the existing connection. I enabled the debug in the JMeter log and I didn’t find errors other than the Read timed out exception..

2022-07-13 10:08:43,840 INFO o.a.j.t.JMeterThread: Thread is done: Presenter 1-1
2022-07-13 10:08:43,840 INFO o.a.j.t.JMeterThread: Thread finished: Presenter 1-1
2022-07-13 10:08:43,840 INFO o.a.j.e.StandardJMeterEngine: Starting ThreadGroup: 2 : ParticipantB
2022-07-13 10:08:43,840 INFO o.a.j.e.StandardJMeterEngine: Starting 1 threads for group ParticipantB.
2022-07-13 10:08:43,840 INFO o.a.j.e.StandardJMeterEngine: Thread will continue on error
2022-07-13 10:08:43,840 INFO o.a.j.t.ThreadGroup: Starting thread group... number=2 threads=1 ramp-up=1 delayedStart=false
2022-07-13 10:08:43,841 INFO o.a.j.t.ThreadGroup: Started thread group number 2
2022-07-13 10:08:43,841 INFO o.a.j.e.StandardJMeterEngine: All thread groups have been started
2022-07-13 10:08:43,841 INFO o.a.j.t.JMeterThread: Thread started: ParticipantB 2-1
2022-07-13 10:08:58,847 DEBUG e.l.j.w.SingleReadWebSocketSampler: I/O Error in sampler 'participantBCommandsRead'.
java.net.SocketTimeoutException: Read timed out
    at sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:280) ~[?:?]
    at sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:306) ~[?:?]
    at sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:347) ~[?:?]
    at sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:800) ~[?:?]
    at java.net.Socket$SocketInputStream.read(Socket.java:966) ~[?:?]
    at sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:478) ~[?:?]
    at sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:472) ~[?:?]
    at sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:70) ~[?:?]
    at sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1455) ~[?:?]
    at sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:1059) ~[?:?]
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:244) ~[?:?]
    at java.io.BufferedInputStream.read(BufferedInputStream.java:263) ~[?:?]
    at eu.luminis.websocket.Frame.parseFrame(Frame.java:61) ~[jmeter-websocket-samplers-1.2.8.jar:?]
    at eu.luminis.websocket.WebSocketClient.receiveFrame(WebSocketClient.java:420) ~[jmeter-websocket-samplers-1.2.8.jar:?]
    at eu.luminis.jmeter.wssampler.WebsocketSampler.readFrame(WebsocketSampler.java:306) ~[jmeter-websocket-samplers-1.2.8.jar:?]
    at eu.luminis.jmeter.wssampler.SingleReadWebSocketSampler.readFrame(SingleReadWebSocketSampler.java:83) ~[jmeter-websocket-samplers-1.2.8.jar:?]
    at eu.luminis.jmeter.wssampler.SingleReadWebSocketSampler.doSample(SingleReadWebSocketSampler.java:71) ~[jmeter-websocket-samplers-1.2.8.jar:?]
    at eu.luminis.jmeter.wssampler.WebsocketSampler.sample(WebsocketSampler.java:169) ~[jmeter-websocket-samplers-1.2.8.jar:?]
    at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:651) ~[ApacheJMeter_core.jar:5.5]
    at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:570) ~[ApacheJMeter_core.jar:5.5]
    at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:501) ~[ApacheJMeter_core.jar:5.5]
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:268) ~[ApacheJMeter_core.jar:5.5]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]

Comments (5)

  1. Peter Doornbosch repo owner

    Hi,

    If the sampler does not capture a message, there probably is no message.

    The easiest way to determine whether the problem is in the server or in JMeter is to make a WireShark capture and see if the message that you are expecting is actually being send.

    There is nothing for that i can investigate here. The message is clear: read time out on the socket. That means that there is nothing to read on the socket. So either Java JDK is broken (unlikely) or your OS is broken (unlikely) or the server did not sent what you are expecting (very likely).

    Hth
    Peter

  2. Zhang Zhao reporter

    Hi Peter,

    「 If the sampler does not capture a message, there probably is no message. 」


    :But I can confirm that there was a message sent out by the publisher as the snapshot below.

    And the same test worked if I changed the structure of my test plan like below:

    I‌ put the publisher and subscriber to different Thread Groups instead of setUp Thread Group. and check “Run Thread Groups consecutively“ in the Test Plan configuration. And it turned out the subscriber was able to capture the message correctly. The reason I didn’t use this test plan is I’m not getting the true latency count on messages sent from publisher to subscribers because I marked to “Run Thread Groups consecutively“, which means that the publisher and subscriber thread groups all run one after the other. So be the time the subscriber thread group run, the message has been sent across for some time, which was not counted. As a result the subscriber appears to get the message almost immediately..

  3. Zhang Zhao reporter

    Hi Peter,

    Thanks for your input. You were right. There was sth. on the server side. I didn’t set up wait time long enough after a subscriber subscribes to a session. I didn’t see the read sampler throwing timed out error after I increased the delay.. FYI..

  4. Log in to comment