3
votes

I am getting 'Non HTTP response message: Connection timed out: connect' for some HTTP requests so I tried to set the connection/response timeout value to 2 minutes (which is more than the connect time required for failing HTTP requests). To do this, I updated "HTTP Request Defaults" and added 120000 as Connect and Response Timeouts.

HTTP Request Defaults timeouts

[HTTP Request Defaults timeouts[1]

However, when I run the test again, the HTTP requests still gave the same error. The sample result is as follows -

Load time: 21007
Connect Time: 21007
Latency: 0
Size in bytes: 2212
Sent bytes:0
Headers size in bytes: 0
Body size in bytes: 2212
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code: Non HTTP response code: java.net.ConnectException
Response message: Non HTTP response message: Connection timed out: connect

It looks like the timeout value I set in HTTP request Defaults is not getting used here. I also tried to set the value of httpclient.timeout=120000 in jmeter.properties but no change. Have I missed something?

Can somebody please help me with this?

Thanks.

Edit - I have multiple HTTP requests and each run, different requests time-out. Here is one of the HTTP requests - HTTP Request Sampler

Updates:

I tried changing the Timeouts values in HTTP Request Defaults to very low (2000) to see how HTTP requests work. In this case, I was getting different error for requests exceeding connection time of 2000ms -

Non HTTP response code: org.apache.http.NoHttpResponseException/Non HTTP response message: : failed to respond

So I think changing the timeout values is not affecting my original error -

Non HTTP response code: java.net.ConnectException/Non HTTP response message: Connection timed out: connect

What is the difference between these two message?

2
Can you show your HTTP Request configuration ?UBIK LOAD PACK
@UBIKLOADPACK, here is the HTTP request configuration -Tej D

2 Answers

3
votes

The issue seems more of a server configuration of connection timeout than client side configuration of connection timeout, though both must be configured appropriately.

Default connectionTimeout in tomcat server is 20 seconds. and you request is failed due to connection timeout at 21 seconds. so, though you configured at client side (120000) you must configure appropriately at server side as well, otherwise, server forces to close the connection attempt and raises Connect Timeout exception.

Reference:

  1. The HTTP Connector (refer connectionTimeout attribute)
1
votes

Recently I have faced the same problem and found that it is the default configuration in my OS (Windows). Check the following links for details:

Where does the socket timeout of 21000 ms come from?

Which is the default TCP connect timeout in Windows?

Shortly, based on articles mentioned in the links above, Windows uses 3000ms initial timeout (InitialRto setting) and does 2 retries with doubled timeout from the previous attempt (MaxSynRetransmissions setting): 3sec + 2*3sec + 4*3sec = 21 sec. In order to increase this timeout you can set more retries with the following command:

netsh interface tcp set global MaxSynRetransmissions=3