Socket connection closing after 1min

Issue #40 invalid
David Wilcox created an issue

Hoping you can help me with this issue. I am using the following samplers:

WebSocket Open Connection Infinite loop of "Websocket Ping/Pong" After the ping/pong loop runs for one minute the socket connection cuts off. The server reports the disconnect reason "ping timeout". I do not want the connection to cut off after one minute; I would like the connection to run indefinitely. Do I need to add something in jmeter to respond to server pings or something like that?

Comments (4)

  1. Peter Doornbosch repo owner

    Hi David,

    If i understand you correctly, the structure of your test plan is something like this:

    • WebSocket Open Connection
    • Loop forever
      • Websocket Ping/Pong

    Right?

    The Websocket Ping/Pong sends a ping and waits for a pong response. If the server reports "ping timeout", maybe the server is sending a ping and waits for a pong (although, if that is the case, i would expect that your "Websocket Ping/Pong" sampler would raise a "unexpected frame type" error....). The easiest way to fix this, is to add a Ping/Pong Frame Filter (see Config Element menu) and check the "Automatically respond to ping with a pong" Filter. Unfortunately, this filter will also filter (discard) the response to your ping, so the "Websocket Ping/Pong" will raise an error, but at least you can avoid the server to close the connection.

    I wonder if you really need client initiated ping if the server sends pings....

    Hth Regards Peter

  2. David Wilcox reporter

    I was able to fix this problem. If I repeatedly talk to the socket using the Ping/Pong sampler, the connection dies after one minute. BUT If I use the Single Write sampler with junk data instead of the Ping/Pong sampler, the connection remains open indefinitely. That is fine for my use case, but I am wondering if the ping pong sampler is not actually sending anything over the socket?

  3. Peter Doornbosch repo owner

    That's strange. The last time i tested it, the ping/pong sampler surely worked correctly, but i'll double check. Maybe you can run the test with the ping/pong again and use wireshark or a similar tool to investigate whether ping/pong samplers is sending ping's?

  4. Log in to comment