0
votes

I have read and tried the solutions shared in the previous posts for this error but nothing helped me to fix this. Kindly help.

I am making a HTTPS API call. A very simple call which accepts a 2 KB JSON message via POST method and sends a one word acknowledgement. It works perfectly fine in Postman tool. In JMeter, no. of threads (users) is kept as 25. It works perfectly fine one time with all 25 success response and at times getting few failure response as

Response code: Non HTTP response code: java.net.SocketException

Response message: Non HTTP response message: Unexpected end of file from server

No consistency at all. I have also tried with both enabling and disabling "use keepalive" checkbox. Both giving me all success one time ; few/all failure at another time with the above error. Please help. Thank you.

Below are the JMeter settings:

  • HTTP Header Manager : Content-Type - application/json
  • HTTPRequest sampler : protocol - HTTPS
  • Server Name or IP : project server name
  • Method : POST
  • PATH : The required path with https authentication details passed as parameters
  • IMPLEMENTATION : Set to JAVA (HTTPCLIENT4 was giving me “443 failed to respond” error)
2

2 Answers

0
votes

Add header Connection Keep-Alive

0
votes

Both errors (Java implementation and Apache HTTPClient4 implementation), are essentially saying the same thing: The server closed the connection, without providing any response. I think there could be the following reasons:

  • Authentication problem. If server side checks authentication before processing a request (e.g. using Spring), it may be rejecting your request, it may be not bothering with any response if authentication is not considered correct.

  • Request Issue. Some less noticeable properties of the request you send via Jmeter are different from what you send in Postman. It could be some minor thing with formatting, or some headers server expects. Some of such inconsistencies can also cause Load Balancer (if you use one) to reject request before it's delivered to the server.

  • Certificate issues. Since you are using HTTPS, you need to make sure your certificate is setup correctly on JMeter side.

So I suggest:

  1. Review server logs and see if your request makes it to the server. If yes, you might be able to see how it was rejected. If not, you need to trace back and see who rejected it (LB, authentication, etc)
  2. Compare headers and body sent by JMeter vs Postman line to line (use TCPDump for example to obtain it).