Why do I get "Unexpected end of file from server" when the MPS is under a heavy load?

212 views (last 30 days)
Dustin Benac
Dustin Benac on 21 Apr 2017
Answered: Dustin Benac on 11 May 2017
I get the following exception when stress-testing my MPS with JMeter:
java.net.SocketException: Unexpected end of file from server
at sun.reflect.GeneratedConstructorAccessor82.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
at org.apache.jmeter.protocol.http.sampler.HTTPJavaImpl.readResponse(HTTPJavaImpl.java:260)
at org.apache.jmeter.protocol.http.sampler.HTTPJavaImpl.sample(HTTPJavaImpl.java:513)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1146)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1135)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:465)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:410)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:241)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(Unknown Source)
at java.net.URLConnection.getHeaderFieldLong(Unknown Source)
at java.net.URLConnection.getContentLengthLong(Unknown Source)
at java.net.URLConnection.getContentLength(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getContentLength(Unknown Source)
at org.apache.jmeter.protocol.http.sampler.HTTPJavaImpl.readResponse(HTTPJavaImpl.java:226)
... 8 more
Is this simply because MPS cannot handle that many concurrent requests? Is there a limit to the number of concurrent requests that can be handled by MPS? If so, what is that limit?
It seems like MPS might queue up requests somehow. If that's true is this behavior documented anywhere? I would like to know the limit to the queue and if there are any timeouts for requests sitting in the queue.

Accepted Answer

Dustin Benac
Dustin Benac on 11 May 2017
I figured out what was happening. I was calling my MPS through a load balancer and the load balancer had an idle timeout set to 60 seconds. It was returning a gateway timeout response but JMeter showed the exception above so it wasn't obvious. I increased the timeout on the lb and no longer got these exceptions.

More Answers (1)

Ankita Nargundkar
Ankita Nargundkar on 27 Apr 2017
To begin with there is no limit on the number of requests MPS can handle. The number of requests that are executed concurrently depends on the value you set for 'numWorkers'. Here is the link to show how you can set number of workers.
All the remaining requests are redirected to the queue. There is also no limit on the number of requests that can be in the queue. However there is a timeout on the requests sitting in the queue. You can probably set the timeout value as mentioned in this link
Further, about the error message you are seeing. Here is some useful information

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!