May 27, 2011

Server has shut down the connection prematurely

server has shutdown the connection prematurely

Just to clarify  "Server xyz has shut down the connection prematurely " has nothing to do with webserver and its not an issues of iis or apache or any other webserver you are using in your application.

This error is thrown by loadrunner and I concur that its one of the major pain area for load testers using loadrunner

Here is the list of solutions available :

1. Do not ramp up too many user at the same time, this will create a clog and start throwing this error. Make sure you have significant ramp up time distributed over a period of time based on your load.

2. Never hold up lot of users at rendez point, this will again create a clog, your limit can vary between 50-70 max, but this number varies with h/w configuration or performance of client machine.

3. Always make sure that retry option in loadrunner run time settings is greater than 5, as it always help in avoiding failure which might occur in initial attempts

4. Always check you network bandwidth, it should not get blocked due to heavy load (check with your IT team), you might face this problem quite often on low bandwidth line.

5. Redistribute the number of vusers from each loadrunner client machine (or remote agents) to decrease the load per client machine. Make sure you are not over utilising the resources.

6. If your scripts were running fine till now and  you suddenly start seeing this error then you should clear the 'Temp' folder from all machines (including loadrunner agents). Location: Documents and Settings-->user-->Local Settings-->Temp  and restart all client machines.

7.  If you just want to avoid seeing this error then you can put below lines in script, though not a solution but can be used as a workaround, you will not see error, but issue will still exist  web_set_sockets_option ("NEW_BEHAVIOR_OF_OVERLAPPED_SEND", "1");

8.  You can also use another statement to ignore this error and continue with rest of them web_set_sockets_option("IGNORE_PREMATURE_SHUTDOWN", "1");  in vuser_init()

9. Sometimes in very specific case this issues is fixed by changing the preference settings,
Run time settings --> Preferences --> Use WinInet Replay instead of Sockets (windows only)

BUT  if all above solution doesn't work then try the master stroke below after follow all suggestions mentioned from point 1 to 6 and then,

10. Restart all load runner machines and servers in your network or load test domain.

It will surely resolve error 'Server has shut down the connection prematurely'. 
There is high possibility that it might reappear after a month or so, you can simply repeat step 10 in that case.

I did thought over it and to me it looks like something to do with lost data packets that are not expired or deleted due to some strange reason.

server xxx has shutdown the connection prematurely
server abc has shutdown the connection prematurely
server "xxx" has shutdown the connection prematurely
server "abc" has shutdown the connection prematurely