Feature Request: Add improved error handling for closed sockets

Issue #13 open
Former user created an issue

Sometimes the socket closes without any warning or error.

It would be nice to have more details in the log as to why it was closed.

"For example, if it was able to detect the frame type, but the payload was truncated, it would be nice to know."

Right now I see the following in the log:

// Error Log

2017/04/03 10:29:03 ERROR - eu.luminis.jmeter.wssampler.SingleReadWebSocketSampler: Error during sampling eu.luminis.websocket.EndOfStreamException: end of stream at eu.luminis.websocket.Frame.parseFrame(Frame.java:42) at eu.luminis.websocket.WebSocketClient.receiveBinaryData(WebSocketClient.java:266) at eu.luminis.jmeter.wssampler.SingleReadWebSocketSampler.doSample(SingleReadWebSocketSampler.java:68) at eu.luminis.jmeter.wssampler.WebsocketSampler.sample(WebsocketSampler.java:110) at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:475) at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:418) at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:249) at java.lang.Thread.run(Unknown Source)

Comments (3)

  1. fsalex

    Seems that the websocket close sampler always creates an error when connected to our server...

    The improved error handling might tell us why. Although, why is it throwing an error when the socket is still open in previous requests?

    jmeter-websocket-close-error.PNG

  2. Peter Doornbosch repo owner

    A regular web-socket close consists of two messages: the closing party (your test plan in this case) sends a close request and the peer answers with a close response. From the stacktrace you posted, i can conclude that sending the close frame succeeded, but reading the response failed because the stream was closed. Maybe, but now i'm speculating, the server didn't bother to answer the close request with a close response, but simple terminated the connection.

    I agree that it would be nice to know whether any byte was received while waiting for the close response, or none at all. From the fact that the exception is thrown on line 42, i can conclude that you received no bytes at all, so it looks like the server has closed the TCP connection before even sending a close response.

  3. Log in to comment