Jmeter response - org.apache.http.NoHttpResponseException: example.com:443 failed to respond - jmeter

Created a test with the login requests and after some time it stops working. Login request is failed with
org.apache.http.NoHttpResponseException: example.com:443 failed to respond
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:939)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:650)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:66)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1301)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1290)
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:651)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:570)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:501)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:268)
at java.base/java.lang.Thread.run(Thread.java:833)
Request details:
Request:
POST https://example.com/auth/token
POST data:
{"scope":"application","grant_type":"sso_token"}
[no cookies]
Request's headers:
Connection: keep-alive
authority: example.com
accept: application/json, text/plain, */*
accept-language: en-US,en;q=0.9
authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6Ii1LSTNROW5OUjdiUm9meG1lWm9YcWJIWkdldyJ9.eyJhdWQiOiIwZGE2MGM0ZDA2LTQ1ZDItYmYxNy1hYTA4ZTE1NDgiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vYmQ1OGI3MDgWY0Ni00ZGViLJkNzgtYmI0ZWY4ODU5ZTZhL3YyLjAiLCJpYXQiOjE2NzYyNQ2NzYsIm5iZiI6MTY3NjI3NDY3NiwiZXhwIjoxNjc2Mjc4NTc2LCJhaW8iOiJBVFFBeS84VEFBQUFzSHA3eVZTU1M4bHJvSlUwZm04ZUwwempXSU5ScGppS1hPd3ZPRWN2Q0NhRGpwRE1udVBlVGxnRlFpSGk3c1pUIiwiZW1haWwiOiJBZGVsZVZATTM2NXg4MzUwNTY1MC5Pbk1pY3Jvc29mdC5jb20iLCJuYW1lIjoiQWRlbGUgVmFuY2UiLCJvaWQiOiI1NWQzNjRjMS02MzZlLTRkOTktOTM4ZS1iMTQ0MjdkYTZhZmIiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJBZGVsZVZATTM2NXg4MzUwNTY1MC5Pbk1pY3Jvc29mdC5jb20iLCJyaCI6IjAuQVU0QUNMZFl2VWJ2NjAyOWVMdE8tSVdlYWswTXBnMEdvTkpGdnhlcUNPRldRQWlEQUxjLiIsInN1YiI6InZjQU9nd0xOTWRZV2JZYWFjU3NJWEFPQ0RZYmpyanRHT1ZuUml3Umk5M2ciLCJ0aWQiOiJiZDU4YjcwOC1lZjQ2LTRkZWItYmQ3OC1iYjRlZjg4NTllNmEiLCJ1cG4iOiJBZGVsZVZATTM2NXg4MzUwNTY1MC5Pbk1pY3Jvc29mdC5jb20iLCJ1dGkiOiJHZll1cXJPWVYwQ2xaUzZnMkRFdUFBIiwidmVyIjoiMi4wIn0.V-h8D1TGj9vb2jVwBFGtm3jBH54lfGMOD_xHWYbfornN5ml31K6FnIumMU5i2oBOUcMpDOgM-2_XCbnWPou5iCc_I703kd_zwW6CAgUDBVJtfSmU6Go--hohzMWZuFG7ftKIX0_ftDmRzqJWOw-bwKy5E4NdXImibeKgQsx_N4QFLMx6X9SVDYhf5mXnabkgpdgEn8m2BtM__mYlCJgw7ci6WRuEg6CzocsrKJrNsiUF74vPLkp-tDkbXZFY-1PvNAzAPQEVUZ2kzIXKDf8_O2vd0ozycaz-MVKw6nxOZnYNzXVaTBvkw9sIFMWbW4biZw7GxgrIIC1ux4KvpXuwA
cache-control: no-cache
content-type: application/json
origin: https://example.com_2.net
User-Agent: Apache-HttpClient/4.5.13 (Java/18.0.2.1)
The Bearer is taken from the previous request which works fine, however it's related to the different authorization system. The process is the following - In the Transaction controller I have get Bearer request from one system and with the Bearer authorize in other service.
If I add all information from the request to the Postmen - everything is fine. That's why I assume the problem on the Jmeter side. I tried different clients implementations in the HTTP Advanced tab sampler, reinstalled Java machine.

What do you mean "after some time"?
The error is pretty clear: the host you're trying to test doesn't repond. JMeter sends a HTTP Request and waits for the response and the response.
If the issue is happening under the particular load and cannot be reproduced at lower loads - it clearly indicates the system under test bottleneck and you need to analyze what is the root cause by
checking baseline operating system health metrics like CPU, RAM, Network, Disk usage, etc. It can be done using JMeter PerfMon Plugin
check application and operating system logs on the system under test side
re-run your test with profiler tool telemetry enabled, it will allow you to see what exactly causes the failure
If you cannot successfully execute request even with 1 user in JMeter and can do this in Postman most probably there is a network connectivity issue, like you're behind a corporate proxy which is being detected automatically by Postman. JMeter cannot auto-detect proxies and you need to explicitly set the details via command-line arguments or system properties.

Related

How to change Content Length in Jmeter

I am stuck at very critical junction of my scripting in Jmeter, I have a requirement to upload a file on Azure storage and a Microservice which analyze the blob data to process further but it looks for certain size, example 8081920 bytes. I am successfully able to upload the the file of same size on Azure storage but the service returns size Mismatch.
If I upload the same file using Postman, service is able to process the image successfully. Below is the Postman request Header
x-ms-blob-type: BlockBlob
Content-Type: image/raw
User-Agent: PostmanRuntime/7.26.10
Accept: /
Postman-Token: b9384ac9-7fbe-4ab8-834b-aef0d8114588
Host: xxxxxxx.blob.xxxxxx.windows.net
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 8081920
Jmeter Request Header:
Connection: keep-alive
Content-Type: image/raw
Accept-Encoding: gzip, deflate, br
Accept: /
x-ms-blob-type: BlockBlob
Content-Length: 8082155
Host: xxxxxxx.blob.xxxxxx.windows.net
User-Agent: PostmanRuntime/7.26.10
Any idea how to resolve this from where jmeter sending additional 235 Bytes but Postman doesn't.
Thanks,
Akshat
Content-Length header is being automatically calculated by both tools as:
sum of request headers (bytes) + request body (bytes)
Given you haven't provided the body we cannot state where the inconsistency lives, from what I can see is that Postman sends Postman-Token and JMeter doesn't so JMeter's Content-Length should be less
In case of multipart file upload the discrepancy can be caused by different boundaries but it shouldn't have any impact on the image processing.
In any case given you're able to successfully upload the file using Postman and cannot do this using JMeter - you can just record the request from Postman using JMeter's HTTP(S) Test Script Recorder - this way you will get confidence that requests are exactly the same. Just make sure to copy the file you're uploading to "bin" folder of your JMeter installation, this way JMeter will be able to properly capture the request.
More information: How to Convert Your Postman API Tests to JMeter for Scaling

Firefox SPNEGO Negotiate protocol - multiple connections?

I'm using gssapi/Kerberos authentication in my web application, and I want single sign on via the browser.
The problem is, Firefox sends an initial request to the server with no authentication, and receives a 401. But it includes a keep-alive header:
Connection: keep-alive
If the server respects this keep-alive request, and returns a WWW-Authenticate header, then Firefox behaves correctly and sends the local user's Kerberos credentials, and all is well.
But, if the server doesn't keep the connection alive, Firefox will not send another request with the credentials, even though the response has the WWW-Authenticate header.
This is a problem because I'm using Django, and Django doesn't support the keep-alive protocol.
Is there a way to make Firefox negotiate without the keep-alive? In the RFC that defines the Negotiate extension, there's nothing about requiring that the same connection be re-used.
Alternatively, is there a way to make Firefofx preemptively send the credentials on the first request? This is explicitly allowed in the RFC.
That header is HTTP 1.0, wake up, fast-forward 15 years and your problems will go away. Firefox works very well with SPNEGO.

Running test script recorder error in JMeter

I have to perform load testing of a particular application and am using JMeter for that.
In my application, I have a unique access token which will be obtained on successful login and this token has to be passed to the consecutive requests to obtain the response.
Now I have added a recorder for my test plan and ran the HTTP test script recorder.all the browser action is recorded in the recorder of the test plan.
the structure of my test plan and workbench is as mentioned below.
**Testplan-**
*Threadgroup*
Recorder-
//inside the recorder
[Request1-login
Request2-To load the uploaded images by the corresponding user]
//Outside the recorder inside the thread group,
View Results Tree
HTTP Cache Manager
HTTP Coockie Manager
**WorkBench**
HTTP(s) Test Script Recorder
By default, there is a header manager for each request when recorded what I did was to add the extracted token obtained using json extracter of the request1 to the header manager of the request2 in the recorded script.
The token is getting passed along with the request header as shown below but the response obtained is unauthorised.
Request Headers:
Connection: keep-alive
Referer: http://localhost/
Accept-Language: en-US,en;q=0.5
Origin: http://localhost
Content-Type: application/json;charset=utf-8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0
Accept: application/json, text/plain, */*
Authorisation:91kLM68tdMBoDFRURArvdmwYgWV9Nr2sHYDwivTM.91kLM68tdMBoDFRURArvdmwYgWV9Nr2sHYDwivTM.Arvdm_M68-BoDFRURArvdmwYgWV9Nr2sHYDwivTM
Content-Length: 0
Host: http://localhost/phpmyadmin/index.php
I have checked the same token in postman and am obtaining the correct response.
am I missing out something?Is there anything else I have to take care of before running the recorded test script?Please help
Compare exactly (Header + Body) requests :
sent by postman
vs request sent by JMeter
There must be a difference somewhere.
And in CookieManager ensure you have set Policy to "standard" if using JMeter 3.x
As per your comment:
Authorization was misspelled (Authorisation)

Method/program for sending a given HTTP request (with headers)

I am debugging my website. When it has an error, the full text form of the HTTP request that caused the error is logged. I want to be able to replay these HTTP requests to help debugging the error.
For instance, I have this in my log now:
POST /ipn/handler.ashx?inst=272&msgType=result HTTP/1.0
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Host: mysite.com
Content-Length: 28
User-Agent: AGENT/1.0 (UserAgent)
region=website&compName=ACTL
I want a way to make this exact request again on my local test machine (with changed Host attribute). What is the best way to do this?
You could use telnet to talk to your web server and type the exact requests.
You could also use libcurl (& curl) to make a program which is an HTTP client.
And many scripting languages (Python, Ruby, Perl, Ocaml, ...) also have HTTP client libraries (sometimes above Curl).

Do we need the "Expect: 100-continue" header in the xfire request header?

I found the apache xfire has add one head parameter in its post header:
POST /testservice/services/TestService1.1 HTTP/1.1
SOAPAction: "testAPI" Content-Type: text/xml; charset=UTF-8
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; XFire Client +http://xfire.codehaus.org)
Host: 192.168.10.111:9082
Expect: 100-continue
Will this Expect: 100-continue make the roundtrip call between the xfire client and its endpoint server a little bit waste because it will use one more handshake for the origin server to return the "willing to accept request"?
This just my guess.
Vance
I know this is old question but as I was just researching the subject, here is my answer. You don't really need to use "Expect: 100-continue" and it indeed does introduce extra roundtrip. The purpose of this header is to indicate to the server that you want your request to be validated before posting the data. This also means that if it is set, you are committed to waiting (within your own timeout period - not indefinitely!) for server response (either 100 or HTTP failure) before sending your form or data. Although it seems like extra expense, it is meant to improve performance in failure cases, by allowing the server to make you know not to send the data (since the request has failed).
If the header is not set by the client, this means you are not awaiting for 100 code from the server and should send your data in the request body. Here is relevant standard: http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html (jump to section 8.2.3).
Hint for .NET 4 users: this header can be disabled using static property "Expect100Continue"
Hint for libcurl users: there was a bug in old version 7.15 when disabling this header wasn't working; fixed in newer versions (more here: http://curl.haxx.se/mail/lib-2006-08/0061.html)

Resources