When executing performance and/or load testing against an SSL-enabled application using Apache JMeter, SSL socket errors can be a frequently encountered nuisance which can severely hinder your testing efforts. This article highlights how to overcome these connection-related errors by configuring and tuning JMeter accordingly.
Examples of error messages that indicate SSL socket issues in Jmeter include the following:
Non HTTP response code: java.net.SocketException Non HTTP response message: Connection reset
Non HTTP response code: java.net.SocketTimeoutException Non HTTP response message: connect timed out
Non HTTP response code: java.net.SocketTimeoutException Non HTTP response message: Read timed out
Recommendation #1: Use latest version of JMeter
It is highly recommended to use the most recent version, to leverage new improvements and components.
Avoid using versions that are older than 3 versions before the last one.
Recommendation #2: Enable DEBUG mode in JMeter
Add the following like to jmeter.properties to enable the JMeter Logger Panel:
jmeter.loggerpanel.display=true
To increase the log level to DEBUG via the JMeter menu:
Options -> Log Level -> DEBUG
To enable debug mode for context and wire logging via log4j2.xml:
<Logger name="org.apache.http" level="debug" />
Recommendation #3: Set Connection timeout
The default connection timeout in JMeter is 20 seconds out-of-the-box. To help diagnose and resolve socket connection issues, it is often helpful to increase this value. To do so, specify a higher connection timeout the HTTP Request object in your JMeter test plan. For example, set to 60000 (milliseconds) to increase the overall timeout to 60 seconds.
Add a ‘HTTP Request Default’ configuration element from the ‘Configuration Elements’ option (i.e., Right-click test plan and add this ‘HTTP Request Default’).
In this ‘HTTP Request Default’, there is an option – Connect in ‘Timeouts (milliseconds)’ Specify your connection timeout value in this field and it will be applied to all child samplers. If this ‘HTTP Request Default’ is added at Test Plan level, then it will be applied to all samplers and all thread groups.
In order to specify individual Connection Timeout, then specify in same field of each sampler. Individual sampler Connection timeout will override the ‘HTTP Request Default’ connection timeout value.
Recommendation #4: Delay Thread Creation
JMeter has an option to delay thread creation until the thread starts sampling (i.e., after any thread group delay and the ramp-up time for the thread itself). This allows for a very large total number of threads, provided that not too many are active concurrently.
Recommendation #5: Disable Parallel Downloads
JMeter uses more resources to simulate the browser parallel fetching of embedded resources like css, gif, js and static content. If there are many users, too many threads may get created and start affecting the response times adversely due to bandwidth contention at the JMeter side. If many users are to be simulated, it’s recommended to disable parallel downloads as JMeter does not simulate browser’s cache and browsers don’t re-download embedded resources on subsequent requests.
Recommendation #6: Configure trusted and client SSL certs
If you have internally-signed or self-signed certificates on your application server tier, JMeter will need to be configured to recognize those certificates as valid. To remedy this, modify system.properties and configure the truststore with the relevant signer certs.
# Truststore properties (trusted certificates)
javax.net.ssl.trustStore=C:/trust.jks
javax.net.ssl.trustStorePassword=sample
If your application requires SSL client certificate authentication or authorization, you will need to create a keystore and set the following properties in the system.properties file pointing to that keystore:
# Keystore properties (client certificates)
javax.net.ssl.keyStore=C:/key.jks
javax.net.ssl.keyStorePassword=sample
Recommendation #7: Tweak JMeter SSL configuration
Set the properties below in the jmeter.properties to adjust the way that JMeter handles SSL sessions, protocols and ciphers:
To enable SSL session sharing:
https.sessioncontext.shared=true
To set Default HTTPS protocol level:
https.default.protocol=TLSv1.2
To enable multiple HTTPS protocols:
https.socket.protocols=TLSv1 TLSv1.2
To enable multiple ciphers:
https.cipherSuites=TLS_RSA_WITH_AES_128_CBC_SHA256 TLS_RSA_WITH_AES_256_CBC_SHA256
To retain SSL context for the duration of test:
https.use.cached.ssl.context=true
To set retry count on http 4
httpclient4.retrycount=1
Recommendation #8: Enable stale connection check
To avoid issues with HTTP connection pooling, it may be necessary to enable a stale connection check in JMeter. This step should be used when receiving “Socket Closed” exceptions during JMeter test runs. To enable the stale connection check, set the following property in user.properties:
http.connection.stalecheck$Boolean=true
Recommendation #9: Enable HTTP Keep-Alive on web servers
Keep-Alive is very important feature of HTTP protocol. It allows the client to make several HTTP requests over single TCP connection. This provides a great performance gain, since otherwise establishing many TCP connections will produce a lot of unnecessary networking overhead.
Recommendation #10: Check the load balancer configuration
If your load test is hitting an application which is fronted by a load balancer, ensure that the load balancer is configured with an adequate max connections limit to handle the anticipated load. Likewise, validate that the load balancing algorithm is not skewing excessive traffic to one or more application server instances, and that load is adequately dispersed amongst application server backends.
Getting the error Response code: No response Response message: Read timeout, no response received.
I am using Jmeter for the load testing of an application which includes web socket connection.
When trying to read the data in a frame using Single Read Sampler,got an error Response code: No response Response message: Read timeout, no response received.
Please find attached the screenshot.
Can anybody help me in solving this issue?
You need to increase or set connection timeout value in Advanced Tab under http request based on that api max response time (check max response time in Aggregate report/summary ).
I am still facing the same Connection issue even after implementing the 3rd step.. increased the timeout to 30,40,90 seconds but no luck..still same issue..
Note: Able to access it in Postman successfully but only facing this connectivity timedout issue in jmeter
Need help.
Thread Name: Thread Group 1-1
Sample Start: 2021-02-08 11:47:58 IST
Load time: 21481
Connect Time: 21481
Latency: 0
Size in bytes: 2233
Sent bytes:0
Headers size in bytes: 0
Body size in bytes: 2233
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
Response headers:
HTTPSampleResult fields:
ContentType:
DataEncoding: null
you are facing a Connection issue in only 1 thread?
tried all fixes mentioned above but still facing the connection reset error in jmeter. what can done further?
Hi All,
I’m facing an error in Jmeter, working with single user. Manually it is working fine in envi.
Thread Name: Thread Group 1-1
Sample Start:2022-08-22 18:42:29 IST
Load time:92714
Connect Time:365
Latency:0
Size in bytes:2988
Sent bytes:0
Headers size in bytes:0
Body size in bytes:2988
Sample Count:1
Error Count:1
Data type (“text”|”bin”|””):text
Response code:Non HTTP response code: java.net.SocketTimeoutException
Response message:Non HTTP response message: Read timed out
Tried everything on this article but no luck.
Response code:Non HTTP response code: java.net.SocketTimeoutException
Response message:Non HTTP response message: Read timed out
Using latest Jmeter as well.. any tips anyone ?
Increasing the timeout of the request helped me to overcome the http socket error.
occurred error:
javax.net.ssl.SSLException: java.net.SocketException: Software caused connection abort: recv failed
solution was:
configure below changes in the HTTP request sampler,
in Advance>
Implementation : Java Timeout(ms) Connect : 60000
Hi,
I get below exception as soon as I launch the JMeter GUI without opening any test plan
================================================================================
Don’t use GUI mode for load testing !, only for Test creation and Test debugging.
For load testing, use CLI Mode (was NON GUI):
jmeter -n -t [jmx file] -l [results file] -e -o [Path to web report folder]
& increase Java Heap to meet your test requirements:
Modify current env variable HEAP=”-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m” in the jmeter batch file
Check : https://jmeter.apache.org/usermanual/best-practices.html
================================================================================
javax.net.ssl|FINE|19|Thread-5|2023-01-30 10:44:49.982 GST|null:-1|jdk.tls.keyLimits: entry = AES/GCM/NoPadding KeyUpdate 2^37. AES/GCM/NOPADDING:KEYUPDATE = 137438953472
javax.net.ssl|FINE|19|Thread-5|2023-01-30 10:44:52.296 GST|null:-1|duplex close of SSLSocket
javax.net.ssl|FINE|19|Thread-5|2023-01-30 10:44:52.297 GST|null:-1|close the underlying socket
javax.net.ssl|FINE|19|Thread-5|2023-01-30 10:44:52.297 GST|null:-1|close the SSL connection (initiative)
javax.net.ssl|FINE|19|Thread-5|2023-01-30 10:44:52.298 GST|null:-1|close inbound of SSLSocket
javax.net.ssl|WARNING|19|Thread-5|2023-01-30 10:44:52.299 GST|null:-1|SSLSocket duplex close failed (
“throwable” : {
java.net.SocketException: Socket is closed
at java.net.Socket.shutdownInput(Unknown Source)
at sun.security.ssl.BaseSSLSocketImpl.shutdownInput(Unknown Source)
at sun.security.ssl.SSLSocketImpl.shutdownInput(Unknown Source)
at sun.security.ssl.SSLSocketImpl.bruteForceCloseInput(Unknown Source)
at sun.security.ssl.SSLSocketImpl.duplexCloseOutput(Unknown Source)
at sun.security.ssl.SSLSocketImpl.close(Unknown Source)
at org.apache.http.impl.SocketHttpClientConnection.shutdown(SocketHttpClientConnection.java:226)
at org.apache.http.impl.conn.DefaultClientConnection.shutdown(DefaultClientConnection.java:162)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.abortConnection(ManagedClientConnectionImpl.java:486)
at org.apache.http.client.methods.AbstractExecutionAwareRequest$2.cancel(AbstractExecutionAwareRequest.java:78)
at org.apache.http.client.methods.AbstractExecutionAwareRequest.abort(AbstractExecutionAwareRequest.java:94)
at org.jmeterplugins.repository.JARSourceHTTP.reportStats(JARSourceHTTP.java:456)
at org.jmeterplugins.repository.http.StatsReporter.run(StatsReporter.java:24)}
)
how can i solve this?
Thread Name:Thread Group 1-122
Sample Start:2024-02-22 14:47:39 SGT
Load time:80645
Connect Time:188
Latency:0
Size in bytes:3487
Sent bytes:0
Headers size in bytes:0
Body size in bytes:3487
Sample Count:1
Error Count:1
Data type (“text”|”bin”|””):text
Response code:Non HTTP response code: java.net.SocketException
Response message:Non HTTP response message: Connection reset by peer
HTTPSampleResult fields:
ContentType:
DataEncoding: null