Non HTTP response code: java.net.UnknownHostException in JMeter - jmeter

I am trying to do load testing using JMeter for the first time.
I am trying to access URL : http://ss12345.localhost:9001/testManagement/login.
The Sampler Result Printed as :
Thread Name:Thread Group 1-1
Sample Start:2020-04-02 18:25:52 IST
Load time:21
Connect Time:21
Latency:0
Size in bytes:2490
Sent bytes:0
Headers size in bytes:0
Body size in bytes:2490
Sample Count:1
Error Count:1
Data type ("text"|"bin"|""):text
Response code:Non HTTP response code: java.net.UnknownHostException
Response message:Non HTTP response message: ss12345.localhost
HTTPSampleResult fields:
ContentType:
DataEncoding: null
I do not understand why it is not picking the userSpecificSubDomain : ss12345.
If I do not specify userSpecificSubDomain then it opens the Login Page otherwise it throws the Non HTTP response code: java.net.UnknownHostException.
For more details, refer to the below images.
Image 1
Image 2

JMeter tries to resolve the IP address of the DNS hostname ss12345.localhost and since it is not known it fails to determine the address therefore it fails.
If you have JMeter and the application under test on your local machine you can:
Add the next line to the hosts file (normally lives under C:\Windows\System32\drivers\etc\hosts)
127.0.0.1 ss12345.localhost
Or alternatively (or if you don't have administrator permissions hence cannot edit the hosts file) you can add a DNS Cache Manager to your Test Plan and specify the mapping there:
Just in case be aware that having the application under test and the load generator running on the same machine is not the best idea as they will start struggling for resources so load test results will not be reliable as you won't be able to tell whether it is a performance bottleneck or it just a lack of i.e. RAM

Related

Getting Non HTTP response message: Connection reset message On Taurus Container

I am getting Non HTTP response message: Connection reset error
I have 2 calls.
POST HTTP request
GET HTTP request: I am extracting the location from the response headers of the first POST call request.
NO cookies or request headers to send for 2nd request.
When I run it from JMeter and Taurus YAML locally, everything works fine.
Running on JMeter on the Taurus container through, it runs fine.
Running YAML through the Taurus container, I am getting the above error: ** Non-HTTP response message: Connection reset**
Test Configuration:
execution:
concurrency: 1
ramp-up: 3s
hold-for: 30s
Not sure where the problem Is?
I tried other options like setting JMeter properties and others, for example:
hc.parameters.file: hc.parameters
http.connection.stalecheck$Boolean: true
https.sessioncontext.shared: true
https.default.protocol: TLSv1.2
https.socket.protocols: TLSv1 TLSv1.2
Checked the jmeter.log and bzt.log file for any errors. But none was found.
We cannot say anything meaningful without:
Knowing your test configuration (how many users, for how long, what is ramp-up, what it time to hold the load)
Seeing jmeter.log file (preferably with debug logging enabled for HTTP components)
Seeing bzt.log file and/or console output, again preferably with verbose switch
Seeing your container and container management engine health metrics (CPU, RAM, Network sockets, etc.)
In your case Taurus acts as a wrapper for JMeter test and it has its extra cost, it might be the case the container doesn't have sufficient resources to run both.

Jmeter report giving errors with distributed mode but errors don`t appear in result tree

I am running my test in distributed mode from the GUI. I have some 20,000 users and two vitual machines have more than 4 VPCUs and 80 Gg memory. I can`t see any stress on any of the machines, neither the slaves or masters, nor the server under test and I could hardly see any error in the GUI. However, in the report, I am having the following errors:
Non HTTP response code: javax.net.ssl.SSLException/Non HTTP response
message: Couldn't kickstart handshaking
Non HTTP response code: javax.net.ssl.SSLException/Non HTTP response
message: readHandshakeRecord
Non HTTP response code: javax.net.ssl.SSLException/Non HTTP response
message: Connection reset
The errors are only 0.05%
Can anyone help me what these errors mean and how can I correct them.
You are not seeing the error in GUI because i.e. View Results Tree listener shows only 500 last results, it is controllable by view.results.tree.max_results JMeter Property and if you add the next line to user.properties file:
view.results.tree.max_results=0
next time you run JMeter you will see each and every request in the View Results Tree listener.
Be informed that GUI mode should be used for tests development and debugging, execution should happen in command-line non-GUI mode
For Couldn't kickstart handshaking and readHandshakeRecord - you can get some troubleshooting information by enabling debug logging for SSL, it can be done by adding the next line to system.properties file:
javax.net.debug=ssl
For Connection reset - see JMeterSocketClosed wiki article
If you have access to your application logs - check them for any suspicious entries
More information:
Apache JMeter Properties Reference
Apache JMeter Properties Customization Guide

How do I solve Jmeter Error Connection reset?

I am running a performance test on a site using Jmeter. Using a load of up to 100 simultaneous users(Threads) the tests pass perfectly, trying to raise this load to 300 users (Threads) I get the following error:
Non HTTP response code: java.net.SocketException / Non HTTP response message: Connection reset
The error occurs in only 0.68% of requests (out of 2412 requests made by 300 users(Threads) only 2 requests generated this error)
I thought it was the maximum number of connections allowed on my server, I went to my application's webconfig and entered the following information: "Min Pool Size = 5; Max Pool Size = 500;". but still not solve the problem.
Does anyone know what I can do to not generate these errors?
Most probably it indicates a problem with your application, try checking:
application logs
application/web server logs and configuration
underlying operating system logs and networking configuration. also pay attention to number of open ports/sockets/handles (can be checked using either built-in OS monitoring tools or JMeter PerfMon Plugin)
If you're absolutely sure that there is nothing wrong with your test script and application and JMeter is configured to behave exactly like a real browser you can follow instructions from JMeterSocketClosed wiki page
More information: The Mysteries of Connection Close

Kindly share if any attribute can be set in properties file or anywhere in jmeter to update the waiting time and maximum tries to get server response

Getting 'response code 504 - GATEWAY TIMEOUT' when run jmeter scripts in distributed mode (1 master, 2 slaves in aws - ec2 instances). Kindly share if any attribute/value can be set in properties file or anywhere in jmeter to update the waiting time and maximum tries to get server response.
Actually you are getting the response already so you don't need to change any properties as they will not have any effect. If you need to retry the request in case of receiving HTTP status code 504 follow the next steps:
Store response code into a JMeter Variable using Regular Expression Extractor like:
Once done you can put your HTTP Request under the While Controller and use the following condition: ${__javaScript("${code}" != "200",)}.
This way JMeter will retry executing the sampler until response code will not become 200.

How to make Jmeter recognize "localhost" URL?

How to do performance testing of localhost url which is accessible only to my computer?
I am able to do performance testing using jmeter for live websites like google etc but jmeter is not able to detect local url.
URL of application-192.168.121.20:8001
2. Output of View Results Tree listener- ALL failed http alerts Description of screenshot of HTTP Request sampler- added only server name i.e URL –
I have the same problem, but my mistake is that I thik the Server Name was the URL Base and it is not works.
This is the wrong way:
Server Name: "localhost/api/v1" (Wrong)
Http Request -> Path: "/auth"
Http Request Defaults (Jmeter):
The correct way:
Server Name: "localhost"
Http Request -> Path: "/api/v1/auth"
Http Request Defaults (Jmeter):
Http Request (Test):
JMeter doesn't care whether application under test is local or remote, if you cannot hit local URL with JMeter - something is wrong with your HTTP Request Sampler configuration, most likely "Port" value is wrong.
In order to be able to help we need to know the following:
1. URL of your application
2. Output of View Results Tree listener
3. Contents of JMeter log
4. Description of screenshot of your HTTP Request sampler
As an alternative option you can try recording your scenario using JMeter Chrome Extension and see if you're able to replay recorded scenario without errors. Again, use View Results Tree listener to inspect request and response details.
In general it is not recommended to run the application under test and the load generator on the same physical or virtual machine as the load generator (JMeter in your case) may consume immense amount of resources like CPU and RAM and it may interfere your application health (unless you're using completely isolated containers), so I would recommend use separate hosts for application and the load generator.
For anyone testing localhost with JMeter for the first time, make sure endpoint are configured correctly.
For a Get request of http://localhost:8080/rest/comments, set:
Server Name or IP: localhost
Port Number: 8080
Path: /rest/comments
Method: Get
please note that i have attached images for each step
Step 1 : First create Thread Group .After Create thread group you will see three part.
Number of thread means how many requests you want to perform and loop count means how many time you want to execute
Step 2 : right click on the thread group Add --> Sampler --> http request as like attach image .In the name filed just give a name as like whats you want.In my case it was Order Service http request
In protocol filed i am going to http request so for that i have given http in the box
In the server name i have set it to localhost because i am using local machine .If you use just remote server then use Ip address or domain name . Don't use http or port number before or after the ip address or domain name
In the port number field i am using 9003 that's why I have given 9003 .
In the http request field use your desired http method in my case i will post some data so i am using POST method so that i have selected post method
Path field just use the path after the ip address or domain name or localhost in my case it was order/create-order . please note that do not add forward slash before that. slash will automatically added by JMeter.
As it is post request so My server side request some body data so i have attached that as json format so click on the body data
step 3 : Sometimes you need to pass some header information for example content type . for that you need to create another option HTTP header manager to create that option . Right click on the thread group then add-> config element- > http header manage as like attach image . I have given the content type
Step 4 : Now you are ready to for request to server but sometimes you need to check the response and other thing so for that click on the thread group then add -> listner -> view result tree
Final Step : To execute the request, click on the greeen button from the top bar.
In order to have Jmeter "recognize" localhost (and any other program on your machine) you have to modify host file:
On Windows
Typically host is located under C:/windows/system32/drivers/etc/. Just open it with any text editor.
Add following record to this file and save changes:
127.0.0.1 localhost
On OSx
Open /private/etc/hosts file for editing with any text editor
Add following record to this file and save changes:
127.0.0.1 localhost
As a result you'll map localhost to your computers default local IP address which is 127.0.0.1
Get your ip addres using ipconfig (windows)
Think your URL is - http://192.168.8.149:3000/api/user/showTeams
Use Server Name or IP -192.168.8.149
Use Port Number - 3000
Use Protocol - http
Use Path - api/user/showTeams
Use IPv4 address instead of using localhost or 127.0.0.1 to access your local application.
Get JMeter's recording template from File > Template.
Set proxy on 8888 port and start recording
In my case, I was running a web app using local Tomcat on port 8080. JMeter was unable to connect using localhost:8080/app-name. It was connecting just fine to the remote-host:8080/app-name.
Solution: I found out that there was another application accessible using 127.0.0.1:8080/another-app. Perhaps, this was confusing JMeter. So, eventually, I changed my tomcat port to 9090 using server.xml and then JMeter was able to connect to localhost:9090/app-name
for your path use http://[::1]:{port}/route
[::1] instead of localhost fixed this for me, took me hours to figure that out

Resources