jmeter load testing 403 forbidden - jmeter

I am running a load test against our application (250 threads with 10 loops) and it never succeeds. error rate dominates with > 95% every run and have no clue what is going wrong. error is 403 forbidden across both GET and POST requests I have cookie manager with Hc4Cookiehandler implementation and policy is set to standard also got cache manager added in my test plan.
I have tweaked the JMeter settings as suggested in other forums, still no luck.
httpclient4.retrycount=1
http.connection.stalecheckBoolean=true
https.default.protocol=TLSv1.2
the interesting part is that certain requests are passing through fine and result 200 success. wondering if something is wrong with the jmeter configuration which is letting major requests to fail.
sample result:
summary = 24000 in 00:00:34 = 702.9/s Avg: 122 Min: 5 Max: 5347 Err: 23795 (99.15%)
403:
1556876389725,12,GET-/visitor/captureJobSearch.do,403,Forbidden,DT-ChildCare 1-45,text,false,Test failed: message expected to contain /OK/,519,945,100,100,11,0,4
200:
1556876387936,1564,GET-/visitor/captureSearchBar.do,200,OK,DT-ChildCare 1-1,text,true,,21616,473,100,100,1561,0,768

403 forbidden is mainly arise due to authentication failure . Try passing the authentication values(all values including JWT token or cookie details) hard corded in cookie manager. And keep the cookie manager in under thread group or just above the requests with Http Header manager.

Related

JMeter marks the request with response code 429 as failed in the Report and ResultsTree

I am testing rate limiting features of an API.
And I have a JMeter HTTP sampler request, for which the anticipated and actual response code is HTTP 429, Too many requests.
But in the Results Tree and in the generated HTML report, this request's response is marked as failure, even though the actual response is 429 and the Response assertions is also for code 429.
Because of this my overall report is skewed with 100% failures, whereas actually everything has passed.
I need ideas on how to fix this Jmeter reporting issue.
Check the attached screencap of the Response in ResultsTree
Of course it does, all HTTP status codes above 399 and below 500 are so called "client errors", in general JMeter treats response status codes above 399 as errors.
If status code 409 is something you expect you can configure JMeter to expect it as well, it can be done using Response Assertion configured like:
More information: How to Use JMeter Assertions in Three Easy Steps

CSS/JQuery extractor is extracting default value in case of load test, for the random threads

Performing a login and update user test with multiple users.
I have created a CSV file with 200 username and passwords. Running 200 threads
Performing login and update user, with 200 users.
I am extracting the value of csrf token in a variable after the login request. Then, I am passing that csrf variable in the user update, post request.
Running the same request with 100 users, I am able to log in and update the user's details.
Running the same request with 200 users.
getting the connection timeout exception.
Some of the update user post requests are getting failed because csrf variable is extracting the default values of CSS/JQuery extractor. CSRF token actual value is not getting extracted to the variable.
I have also added Authorization, Cookie, Cache and Header Manager in my test plan.
The constant timer is also being used after login request.
I have set the value of timeouts to 120000 in the HTTP request defaults. Even if I am increasing the timeouts, getting the same exception.
Most probably your application under test simply gets overloaded therefore it cannot respond in a timely fashion.
With regards to CSS/JQuery extractor which is failing to get CSRF token - my expectation is that the token is not present in the response for failing samplers.
So I would recommend taking the following troubleshooting steps:
Completely remove Connect and Response timeouts in the HTTP Request Defaults so JMeter will wait for response forever.
Configure JMeter to save responses for failed samplers by adding the next 2 lines to user.properties file:
jmeter.save.saveservice.output_format=xml
jmeter.save.saveservice.response_data.on_error=true
this way you will be able to see how does response look like for failing requests. See Results File Configuration User Manual chapter to learn what other metrics could be useful for your analysis.
Check your application and middleware (web/application/database server/load balancer logs)
Make sure to set up monitoring of baseline OS health metrics on the application under test side. You can do this using JMeter PerfMon Plugin
Just in case double check you're following JMeter Best Practices

Jmeter - Internal server error 500 in jmeter response code

I have recorded script in jmeter V3.3 via IE browser and then done correlation. When I run this script, then it is receiving internal server error 500 in response, however it works fine manually in IE browser and also while recording this scenario, it does not occur.
I also cross verified Header manager with Request Headers in network IE F12 Developer tool and it is uptodate.
Sampler Request
Http Get Request
It is simply Get request. I really appreciate for your help to handle this error in jmeter.
I hope you have compared both Request Headers one from IE Browser and from JMETER request headers to check if anything is not missing to pass. And also along with any dynamic id is not missing.
You are likely not checking for expected results with each step. As a result, you are receiving an HTTP 200 correct response page prior to your HTTP 500, but the content of the page is out of context with the expected results for the business process. When you make your next request the state of the application is not appropriate to your request. As an unhandled condition by the developer you are greeted with an HTTP 500 screen dump.
Most likely cause: Unhandled dynamic data component.

JMeter error : java.net.SocketException: Unexpected end of file from server

I have read and tried the solutions shared in the previous posts for this error but nothing helped me to fix this. Kindly help.
I am making a HTTPS API call. A very simple call which accepts a 2 KB JSON message via POST method and sends a one word acknowledgement. It works perfectly fine in Postman tool. In JMeter, no. of threads (users) is kept as 25. It works perfectly fine one time with all 25 success response and at times getting few failure response as
Response code: Non HTTP response code: java.net.SocketException
Response message: Non HTTP response message: Unexpected end of file from server
No consistency at all. I have also tried with both enabling and disabling "use keepalive" checkbox. Both giving me all success one time ; few/all failure at another time with the above error. Please help. Thank you.
Below are the JMeter settings:
HTTP Header Manager : Content-Type - application/json
HTTPRequest sampler : protocol - HTTPS
Server Name or IP : project server name
Method : POST
PATH : The required path with https authentication details passed as parameters
IMPLEMENTATION : Set to JAVA (HTTPCLIENT4 was giving me “443 failed to respond” error)
Add header
Connection Keep-Alive
Both errors (Java implementation and Apache HTTPClient4 implementation), are essentially saying the same thing: The server closed the connection, without providing any response. I think there could be the following reasons:
Authentication problem. If server side checks authentication before processing a request (e.g. using Spring), it may be rejecting your request, it may be not bothering with any response if authentication is not considered correct.
Request Issue. Some less noticeable properties of the request you send via Jmeter are different from what you send in Postman. It could be some minor thing with formatting, or some headers server expects. Some of such inconsistencies can also cause Load Balancer (if you use one) to reject request before it's delivered to the server.
Certificate issues. Since you are using HTTPS, you need to make sure your certificate is setup correctly on JMeter side.
So I suggest:
Review server logs and see if your request makes it to the server. If yes, you might be able to see how it was rejected. If not, you need to trace back and see who rejected it (LB, authentication, etc)
Compare headers and body sent by JMeter vs Postman line to line (use TCPDump for example to obtain it).

1.wrong credentials is running pass in data driven-Jmeter

jmeter reads credentials from CSV. even if I have wrong credentials in the csv file (1/5login credentials) script shows successful.Does it check database while running? Which means 2 credentials is wrong, it supposed to shows fail, but it shows pass result(app angular JS type)
In the CSV file, I have 5 credentials and threads also 5...but in the output I got only 4 results
JMeter neither checks response nor database. In case of web applications JMeter automatically treads HTTP response codes < 400 as successful so if your web server responded with HTTP Status Code 200 (OK) - you will have "green" result even if your login wasn't successful.
You might wish to add i.e. Response Assertion to your request to ensure that response doesn't contain error messages or contain something, which indicates a logged in user, i.e. "Welcome" text or whatever.
See How to Use JMeter Assertions in Three Easy Steps article for more information on conditionally failing JMeter samplers.

Resources