SignalR - Http Upgrade failed with status code 400

Issue #90 closed
BobM created an issue

Hi,

I'm getting error "Http Upgrade failed with status code 400" from time to time during handshake. The thing is sometimes it works, returns 101 Switching Protocols response message but sometimes "Http Upgrade failed with status code 400". Any ideas how to fix this issue?

Back-end is powered by ASP.NET SignalR.

Best,

Bob

Comments (4)

  1. Peter Doornbosch repo owner

    Hi,

    No, i have no idea. It's your server that sends the 400 status, you should ask him. Check logging of server. You could enable debug logging for the plugin to see what the server returns exactly in its http response, that might give a clue where to look.

    Hth, Peter

  2. BobM reporter

    Hi Peter,

    The interesting thing is when I open website with browser web sockets returns correct response code and response message all the time. I agree that it's probably server-side issue. Just in case wanted to double check. Here is debug log:

    2018-09-19 16:57:11,938 DEBUG e.l.j.w.OpenWebSocketSampler: Http upgrade error in sampler 'WebSocket Open Connection'.
    eu.luminis.websocket.HttpUpgradeException: Http Upgrade failed with status code 400
        at eu.luminis.websocket.WebSocketClient.checkHttpStatus(WebSocketClient.java:510) ~[jmeter-websocket-samplers-1.2.1.jar:?]
        at eu.luminis.websocket.WebSocketClient.checkServerResponse(WebSocketClient.java:460) ~[jmeter-websocket-samplers-1.2.1.jar:?]
        at eu.luminis.websocket.WebSocketClient.connect(WebSocketClient.java:186) ~[jmeter-websocket-samplers-1.2.1.jar:?]
        at eu.luminis.websocket.WebSocketClient.connect(WebSocketClient.java:104) ~[jmeter-websocket-samplers-1.2.1.jar:?]
        at eu.luminis.jmeter.wssampler.WebsocketSampler.sample(WebsocketSampler.java:159) [jmeter-websocket-samplers-1.2.1.jar:?]
        at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:490) [ApacheJMeter_core.jar:4.0 r1823414]
        at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:416) [ApacheJMeter_core.jar:4.0 r1823414]
        at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:250) [ApacheJMeter_core.jar:4.0 r1823414]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
    

    Best,

    Bob.

  3. Peter Doornbosch repo owner

    Hi Bob,

    Shame on me. I expected debug logging that showed the actual HTTP response, but i just checked the source and must conclude that this is not logged when the return code is not 101 ;-(. It should however log the first line of the response, something like "<< HTTP/1.1 400", didn't you see that in the log? Not that it i expect it will tell much we don't know yet, but it might tell why it returns 400...

    If you have reason to believe it's the plugin that sends an incorrect request now and then, the best thing to do would be to use WireShark or tcpdump to capture the websocket connection setup. Once you've got such a capture, you can mail it to me and i'll have a look......

    Regards Peter

    Sorry for my somewhat blunt first reaction, i get too many requests from people to help them debug their environment.... ;-(

  4. Log in to comment