Bug 52126 - HttpClient4 does not clear cookies between iterations
HttpClient4 does not clear cookies between iterations
Status: RESOLVED WORKSFORME
Product: JMeter
Classification: Unclassified
Component: HTTP
2.7
All All
: P2 major (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2011-11-02 22:18 UTC by mail
Modified: 2012-11-01 15:27 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mail 2011-11-02 22:18:09 UTC
When using HttpClient4 the HTTP Cookie Manager "Clear cookies each iteration?" setting has no effect. Even with this setting enabled, cookies are not being cleared between iterations on the same thread.

This affects both HTTP and HTTPS protocol.

The same exact setup using the Implementation HttpClient3.1 or Java have not got the problem.

JMeter, however, does not report this on the Request tab of the "View Results Tree" listener. Here it shows "[no cookies]". But using WireShark it is possible to see that the same request has been sent using the Cookies set on the previous request (which was on the previous iteration).


System settings:
OS: Mac OS 10.7.2 (Lion)
Apache JMeter Version 2.5.1 r1177103
java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-383-11A511)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-383, mixed mode)
Comment 1 Sebb 2011-11-03 14:49:07 UTC
Thanks for the report.

Forgot to disable automatic cookie handling in HC4 - oops!

Now fixed:

URL: http://svn.apache.org/viewvc?rev=1197164&view=rev
Log:
Bug 52126 - HttpClient4 does not clear cookies between iterations

Modified:
   jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
   jmeter/trunk/xdocs/changes.xml
Comment 2 brycelin 2012-06-06 03:52:34 UTC
Hi there,

The issue has been fixed for domain cookies (cookie with a domain).

For host cookies, the issue still persists even in the latest version JMeter 2.7. It does not clear host cookies (cookie without a domain) between loop iterations. It happens in all http client implementations: Java, HttpClient3.1 and 4.

Please have a look.

Thanks,
Bryce
Comment 3 brycelin 2012-06-06 15:31:03 UTC
Hi,

To avoid any confusion, we used Cookie Manager with a Loop Controller. It does not clear any cookies unless cookies are explicitly expired in a http response.

It works fine with Thread Group - cookies are cleared properly for each loop iteration.

Thanks,
Bryce
Comment 4 Philippe Mouawad 2012-06-06 17:13:05 UTC
Hello,
CAN you attach à simple test plan showing issue ?
Thanks
Regards
Philippe
Comment 5 Philippe Mouawad 2012-06-06 19:42:14 UTC
(In reply to comment #3)
> Hi,
> 
> To avoid any confusion, we used Cookie Manager with a Loop Controller. It
> does not clear any cookies unless cookies are explicitly expired in a http
> response.
> 
> It works fine with Thread Group - cookies are cleared properly for each loop
> iteration.
> 
> Thanks,
> Bryce

So I close issue as it is not related.
I suggest you open a new issue as Enhancement saying:
"CookieManager: Cookies are not cleared on iteration of LoopController"

I made some tests and cookies are correctly cleared with or without domain when placed at Thread Group level and within iteration of Thread Group (as you say)
Indeed they are not for iterations of LoopController which is not a bug request but an enhancement request that will or will not be implemented.
Comment 6 bea 2012-09-27 11:20:54 UTC
I believe such 'enchancement' has been already present in the 2.3.4, be it bug or a feature - if there arrived new cookie named the same as existing one, it was overwritten. 

So I suppose downgrading is a solution for those intrested in it as a feature.
Comment 7 Sebb 2012-11-01 15:27:20 UTC
(In reply to comment #6)
> I believe such 'enchancement' has been already present in the 2.3.4, be it
> bug or a feature - if there arrived new cookie named the same as existing
> one, it was overwritten. 

If that is true, then it is a different issue.

New cookies with the same name should replace existing ones.
If that is *not* the case, please open a new Bugzilla with the details.