Bug 60682 - HTTP Request : Get method may fail on redirect due to Content-Length header being set
Summary: HTTP Request : Get method may fail on redirect due to Content-Length header b...
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 3.1
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-02 16:59 UTC by Amar
Modified: 2019-09-05 06:04 UTC (History)
1 user (show)



Attachments
results and other debug information (296.09 KB, application/zip)
2017-02-03 15:07 UTC, Amar
Details
with DEBUG enabled (744.34 KB, application/zip)
2017-02-03 16:25 UTC, Amar
Details
Don't use a body on a GET request, that is send on redirect (1.08 KB, patch)
2017-02-06 14:23 UTC, Felix Schumacher
Details | Diff
last redirect missing compared to 2.13 version (849.48 KB, image/jpeg)
2017-02-06 16:54 UTC, Amar
Details
log file from 2.13 version (210.65 KB, application/zip)
2017-02-06 17:11 UTC, Amar
Details
still log not getting generated. (248.11 KB, image/jpeg)
2017-02-06 17:42 UTC, Amar
Details
I removed that line but still no log file getting created (210.41 KB, image/jpeg)
2017-02-06 19:31 UTC, Amar
Details
log from nightly build (75.25 KB, text/plain)
2017-02-06 21:16 UTC, Amar
Details
My cookie manager (228.18 KB, image/jpeg)
2017-02-06 21:25 UTC, Amar
Details
its working now (68.57 KB, image/jpeg)
2017-02-06 21:35 UTC, Amar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Amar 2017-02-02 16:59:57 UTC
My script is working absolutely fine on 2.13 but doesn't work on 3.1 Its not doing the re-directs correctly during authorization and subsequent requests are failing with 401 errors. Let me know the debug information you need to help fix this issue.
Comment 1 Amar 2017-02-03 15:07:51 UTC
Created attachment 34712 [details]
results and other debug information
Comment 2 UbikLoadPack support 2017-02-03 16:06:52 UTC
Could you show the errors in more details ?
Show every tab of the red query.
Are the URLs of your test plan accessible from anybody on Internet ?


Logs show nothing useful, maybe you can add to user.properties:
log_level.org.apache.http=DEBUG

Run your plan again for both versions and provide jmeter.log for each ?
Thanks
Comment 3 Amar 2017-02-03 16:25:58 UTC
Created attachment 34713 [details]
with DEBUG enabled

Unfortunately those servers are not accessible on the public internet. I can show the scenario on a screen share session or i can take a video of my screen with all the tabs and post it later, if required. I have attached logs with DEBUG turned on. Please have a look and see if there is anything else i could add to make this debugging faster. Thank you !
Comment 4 Philippe Mouawad 2017-02-04 20:52:50 UTC
Hello
I think your bug is a duplicate of Bug 60575.

I see an additional header for redirected gzt is sent ("Content-Length: 134").

Could you try nightly build ?:

http://jmeter.apache.org/nightly.html

If issue persists ,please reopen . Otherwise give us your feedback on this one.

Thank you

*** This bug has been marked as a duplicate of bug 60575 ***
Comment 5 Amar 2017-02-06 11:43:49 UTC
I have tried it again with nightly build, but the request is still failing. I still see the "Content-Length: 134" in the redirected request.
Comment 6 Felix Schumacher 2017-02-06 14:23:09 UTC
Created attachment 34718 [details]
Don't use a body on a GET request, that is send on redirect

Could you test the patch and see, if it helps?
Comment 7 Amar 2017-02-06 14:54:54 UTC
Could you please explain how to apply the patch please. I have looked for HTTPHC4Impl.java file but couldn't find it.
Comment 8 UbikLoadPack support 2017-02-06 16:17:34 UTC
(In reply to Amar from comment #7)
> Could you please explain how to apply the patch please. I have looked for
> HTTPHC4Impl.java file but couldn't find it.

A new version is available in nightly build:
https://builds.apache.org/job/JMeter-trunk/5804/

Can you test it and give your feedback ?
Thanks
Comment 9 Amar 2017-02-06 16:53:22 UTC
There is definitely a change in behaviour in this new nightly build but its didn't seem to fix the full problem yet. It somehow not doing the further redirect(3rd redirect) successfully like in 2.13 version.

Please check the attachment and suggest next steps.
Comment 10 Amar 2017-02-06 16:54:28 UTC
Created attachment 34721 [details]
last redirect missing compared to 2.13 version
Comment 11 UbikLoadPack support 2017-02-06 16:56:31 UTC
(In reply to Amar from comment #10)
> Created attachment 34721 [details]
> last redirect missing compared to 2.13 version

Hello,
Please put both JMeter in debug as explained earlier (log_level.org.apache.http=DEBUG) and provide the log files for both runs 2.13 and 3.2-nightly
Screenshot are incomplete and hard to use.
Thank you
Comment 12 Amar 2017-02-06 17:11:43 UTC
Created attachment 34722 [details]
log file from 2.13 version

I don't see jmeter.log in the nightly version. Most likely another bug or something but i am attaching log file from 2.13 version now
Comment 13 UbikLoadPack support 2017-02-06 17:19:19 UTC
(In reply to Amar from comment #12)
> Created attachment 34722 [details]
> log file from 2.13 version
> 
> I don't see jmeter.log in the nightly version. Most likely another bug or
> something but i am attaching log file from 2.13 version now

It's not a bug, logging management has changed yesterday (JMeter migrated to log4j2 and slf4j).

Can you edit log4j2.xml and uncomment:
<!-- <Logger name="org.apache.http" level="debug" /> -->

Regards
Comment 14 Amar 2017-02-06 17:42:22 UTC
Created attachment 34723 [details]
still log not getting generated.

Please check if i enabled the logging right.
Comment 15 Philippe Mouawad 2017-02-06 17:54:05 UTC
(In reply to Amar from comment #14)
> Created attachment 34723 [details]
> still log not getting generated.
> 
> Please check if i enabled the logging right.

Remove the line with error level please
Comment 16 Amar 2017-02-06 19:31:43 UTC
Created attachment 34724 [details]
I removed that line but still no log file getting created
Comment 17 UbikLoadPack support 2017-02-06 19:42:33 UTC
Comment on attachment 34724 [details]
I removed that line but still no log file getting created

I don't understand , I've just tested now and it works for me
How do you start JMeter ?
Comment 18 Amar 2017-02-06 19:57:29 UTC
I double click ApacheJMeter.jar file to start jMeter
Comment 19 UbikLoadPack support 2017-02-06 20:06:56 UTC
(In reply to Amar from comment #18)
> I double click ApacheJMeter.jar file to start jMeter

It's not the correct way to run it.
Run either jmeter.sh if you're on Linux or jmeter.bat if you're on windows
Comment 20 Amar 2017-02-06 20:12:32 UTC
It shows me this when i started it with jmeter.sh . Something related to loading class


MacBook-Pro-2:bin Amar$ ./jmeter.sh 
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
================================================================================
Don't use GUI mode for load testing, only for Test creation and Test debugging !
For load testing, use NON GUI Mode:
   jmeter -n -t [jmx file] -l [results file] -e -o [Path to output folder])
& adapt Java Heap to your test requirements:
   Modify HEAP="-Xms512m -Xmx512m" in the JMeter batch file
==========================================
Comment 21 UbikLoadPack support 2017-02-06 20:35:50 UTC
(In reply to Amar from comment #20)
> It shows me this when i started it with jmeter.sh . Something related to
> loading class
> 
> 
> MacBook-Pro-2:bin Amar$ ./jmeter.sh 
> SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
> SLF4J: Defaulting to no-operation (NOP) logger implementation
> SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further
> details.
> =============================================================================
> ===
> Don't use GUI mode for load testing, only for Test creation and Test
> debugging !
> For load testing, use NON GUI Mode:
>    jmeter -n -t [jmx file] -l [results file] -e -o [Path to output folder])
> & adapt Java Heap to your test requirements:
>    Modify HEAP="-Xms512m -Xmx512m" in the JMeter batch file
> ==========================================
There a packaging issue in nightly build.
Following jars are missing:
log4j-1.2-api-2.7.jar
log4j-core-2.7.jar
log4j-slf4j-impl-2.7.jar

Can you download them and add them to lib folder:
https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-1.2-api/2.7/
https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core/2.7/
https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-slf4j-impl/2.7/

Team will fix issue for next nightly.
Thanks
Comment 22 Philippe Mouawad 2017-02-06 21:11:48 UTC
Hello,
Issue with logs is now fixed in nightly available on jenkins if you want to test.

Regards
Comment 23 Amar 2017-02-06 21:16:08 UTC
Created attachment 34725 [details]
log from nightly build

I am able to get the log now on the nightly build. I see some errors saying something about unable to add the cookie


2017-02-06 21:13:15,469 ERROR o.a.j.p.h.c.HC4CookieHandler: Unable to add the cookie
org.apache.http.cookie.MalformedCookieException: Invalid 'expires' attribute: Tue, 07 Feb 2017 09:13:14 GMT
	at org.apache.http.impl.cookie.BasicExpiresHandler.parse(BasicExpiresHandler.java:64) ~[httpclient-4.5.3.jar:4.5.3]
	at org.apache.http.impl.cookie.CookieSpecBase.parse(CookieSpecBase.java:113) ~[httpclient-4.5.3.jar:4.5.3]
	at org.apache.http.impl.cookie.DefaultCookieSpec.parse(DefaultCookieSpec.java:140) ~[httpclient-4.5.3.jar:4.5.3]
	at org.apache.jmeter.protocol.http.control.HC4CookieHandler.addCookieFromHeader(HC4CookieHandler.java:125) [ApacheJMeter_http.jar:r1781918]
	at org.apache.jmeter.protocol.http.control.CookieManager.addCookieFromHeader(CookieManager.java:375) [ApacheJMeter_http.jar:r1781918]
	at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.saveConnectionCookies(HTTPHC4Impl.java:1526) [ApacheJMeter_http.jar:r1781918]
	at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:486) [ApacheJMeter_http.jar:r1781918]
	at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74) [ApacheJMeter_http.jar:r1781918]
	at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.followRedirects(HTTPSamplerBase.java:1526) [ApacheJMeter_http.jar:r1781918]
	at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.resultProcessing(HTTPSamplerBase.java:1620) [ApacheJMeter_http.jar:r1781918]
	at org.apache.jmeter.protocol.http.sampler.HTTPAbstractImpl.resultProcessing(HTTPAbstractImpl.java:519) [ApacheJMeter_http.jar:r1781918]
	at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:494) [ApacheJMeter_http.jar:r1781918]
	at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74) [ApacheJMeter_http.jar:r1781918]
	at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1176) [ApacheJMeter_http.jar:r1781918]
	at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1165) [ApacheJMeter_http.jar:r1781918]
	at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:473) [ApacheJMeter_core.jar:r1781918]
	at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:416) [ApacheJMeter_core.jar:r1781918]
	at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:252) [ApacheJMeter_core.jar:r1781918]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_112]
Comment 24 Philippe Mouawad 2017-02-06 21:22:36 UTC
Thanks.
Could you show your CookieManager configuration please ?
Thanks
Comment 25 Amar 2017-02-06 21:25:36 UTC
Created attachment 34726 [details]
My cookie manager
Comment 26 Philippe Mouawad 2017-02-06 21:27:48 UTC
Comment on attachment 34726 [details]
My cookie manager

Can you switch it to Standard as per this:

- http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Cookie_Manager

Cookie Policy
The cookie policy that will be used to manage the cookies. "standard" is the default since 3.0, and should work in most cases.
Comment 27 Amar 2017-02-06 21:35:54 UTC
Created attachment 34727 [details]
its working now

Thats perfect... Its working now !

Shall i keep working on the nightly build or shall i take the official build tomorrow ? I am not quite familiar with the process. Please suggest. Thank you !
Comment 28 Amar 2017-02-06 21:38:17 UTC
Could you also give me a high level view of what was the root cause of this problem and what was fixed to get it working ? Its for my own understanding of jMeter issues
Comment 29 Philippe Mouawad 2017-02-06 21:40:46 UTC
(In reply to Amar from comment #27)
> Created attachment 34727 [details]
> its working now
> 
> Thats perfect... Its working now !
> 
> Shall i keep working on the nightly build or shall i take the official build
> tomorrow ? I am not quite familiar with the process. Please suggest. Thank
> you !

Nightly build is usually not an official release and may be broken as you have seen.
We are currently working on full migration to slf4j + log4j2 and then we may release a version if a consensus on this is reached.

If you're willing to work on nightly and can report any bug you face it will help us a lot and ensure 3.2 does not contain those bugs, but otherwise wait for next version.

Regards
Comment 30 Philippe Mouawad 2017-02-06 21:51:10 UTC
(In reply to Amar from comment #28)
> Could you also give me a high level view of what was the root cause of this
> problem and what was fixed to get it working ? Its for my own understanding
> of jMeter issues

Issue was introduced by enhancement (Bug 60358) of 3.1 version.
Comment 31 Amar 2017-02-07 10:22:52 UTC
When is the release date for 3.2 ?
Comment 32 Philippe Mouawad 2017-02-07 21:06:34 UTC
Date: Mon Feb  6 15:46:29 2017
New Revision: 1781918

URL: http://svn.apache.org/viewvc?rev=1781918&view=rev
Log:
Bug 60575 - HTTP request: Even if there are no Parameters, a Body is sent for GET method
Handle redirect , patch by Felix Schumacher for testing (may be rollbacked)
Bugzilla Id: 60575

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java


Revision: 1781918
Modified property: svn:log

Modified: svn:log at Tue Feb  7 21:05:43 2017
------------------------------------------------------------------------------
--- svn:log (original)
+++ svn:log Tue Feb  7 21:05:43 2017
@@ -1,3 +1,3 @@
-Bug 60575 - HTTP request: Even if there are no Parameters, a Body is sent for GET method
+Bug 60682 - HTTP Request : Get method may fail on redirect due to Content-Length header being set
 Handle redirect , patch by Felix Schumacher for testing (may be rollbacked)
-Bugzilla Id: 60575
+Bugzilla Id: 60682
Comment 33 The ASF infrastructure team 2022-09-24 20:38:07 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/4261