Next Practical Step
Add httpclient4.validate_after_inactivity=2000 to user.properties and verify that the error disappears on the next test execution.
Fix JMeter org.apache.http.NoHttpResponseException: The target server failed to respond. Understand HTTP keep-alive race conditions and connection reuse tuning.
In View Results Tree, JTL results, or jmeter.log, HTTP samplers fail intermittently with:
Response code: Non HTTP response code: org.apache.http.NoHttpResponseExceptionResponse message: Non HTTP response message: The target server failed to respondThe error typically appears intermittently during tests with think time, between loop iterations, or when reusing pooled connections over HTTP Keep-Alive.
NoHttpResponseException occurs when JMeter sends an HTTP request over an established persistent (Keep-Alive) TCP socket that the server or intermediate proxy has already closed due to an idle timeout. When JMeter transmits bytes on the stale connection, the server drops or resets the socket without returning an HTTP response line.
| Cause | Why it happens |
|---|---|
| Keep-Alive race condition | Server idle timeout (e.g. 5s) is shorter than JMeter’s connection reuse interval / think time |
| Server connection backlog full | Target server or load balancer terminates idle client connections under heavy memory or socket pressure |
| Intermediate proxy / NAT timeout | Firewalls (AWS ALB, Nginx, Cloudflare) close idle TCP connections silently without TCP FIN packets |
| Stale connection checking disabled | JMeter uses pooled sockets without validating whether the connection is still alive before sending data |
| Thread iteration state | Previous thread loop left an open TCP connection in a state that the server subsequently closed |
user.propertiesConfigure JMeter’s underlying Apache HttpComponents HttpClient to check whether a connection is stale before transmitting a new request. Add the following to bin/user.properties:
# Validate idle persistent connections if inactive for more than 2000mshttpclient4.validate_after_inactivity=2000
# Set maximum connection Time-To-Live (in milliseconds)httpclient4.time_to_live=60000
# Set idle connection timeout (in milliseconds)httpclient4.idletimeout=10000Ensure each iteration starts with a clean connection state if your virtual users simulate independent sessions:
HttpClient4 (the default and recommended client).Check your web server / reverse proxy Keep-Alive configuration:
keepalive_timeout 65; (ensure JMeter httpclient4.idletimeout is lower than this value, e.g. 60000).KeepAliveTimeout 5.If JMeter holds connections longer than the upstream timeout, JMeter will attempt to send requests over dead sockets.
By default, JMeter’s HttpClient4 does not automatically retry non-idempotent requests (like POST or PUT) if a socket drops. You can configure retry behavior in user.properties:
# Number of retries on connection reset (default: 0 in modern JMeter)httpclient4.retrycount=1
# Whether to retry request sent failurehttpclient4.request_sent_retry_enabled=true| Resource | Use when |
|---|---|
| Socket closed / connection reset | Server abruptly resets active TCP connection |
| SocketTimeoutException | Server receives request but response is too slow |
| HTTP 502/503/504 | Proxy responses when backends fail to respond |
| Properties Cheat Sheet | Quick lookup for httpclient4.* properties |
When threads pause for Timers (e.g. 10 seconds), the pooled TCP connection sits idle. If the server idle timeout is 5 seconds, the server closes the connection during the think time. When JMeter resumes, it tries to use the dead connection.
No. It is a standard TCP/HTTP Keep-Alive timing condition. Setting httpclient4.validate_after_inactivity=2000 prevents JMeter from writing to closed sockets.
Only if your target application architecture does not support Keep-Alive. Disabling Keep-Alive forces a fresh TCP and TLS handshake for every single request, which creates CPU overhead and can cause ephemeral port exhaustion.