Bug 35013 - HTTP Cookie Manager doesn't retain session cookies for duration of Thread execution
Summary: HTTP Cookie Manager doesn't retain session cookies for duration of Thread exe...
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 2.0.3
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-22 21:43 UTC by Robin D. Wilson
Modified: 2006-05-04 18:29 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robin D. Wilson 2005-05-22 21:43:41 UTC
When I create a simple thread, hitting a single page that returns a session
cookie, and then redirects to another page, the session cookie is not available
for the rest of the thread. I think the issue is related to another defect I
read where "expired" cookies are removed immediately. Unfortunately, an
"expired" cookie is actually a session cookie - and I need them to stay around
until the thread is finished, so they can be used by subsequent HTTP Requests
within the same thread.
Comment 1 Sebb 2005-05-25 00:58:19 UTC
Can you post details of the Cookie that is being dropped? In particular, what is
the Expiration value?
Comment 2 Robin D. Wilson 2005-05-25 17:08:58 UTC
The "Set-Cookie" looks like this:

Set-Cookie:
MySessionId=634707E375652E48855X39524X530E78117B5A5B64AF429A512F6048EF8284EEH08D5C1177E

Notice, there is no domain set, no path set, and no expiration set. It is just
the data...
Comment 3 Sebb 2005-05-26 01:07:56 UTC
Various fixes made to Cookie Manager to ensure expiry is always expressed in
seconds.  Extra debug and test cases added.

Hopefully these will solve the problem (or at least the debug will enable it to
be investigated further).
Comment 4 Sebb 2005-06-12 01:40:48 UTC
Have the fixes helped?
Comment 5 Robin D. Wilson 2005-06-13 06:36:32 UTC
I just tried the build for 6/11 - no dice. 

I see the cookie get set on the first request, I see it attached to the second
request - then it goes away, never to return... It's as though the Cookie
Manager thinks that when it doesn't come back from the server, it should delete
it... This tends to play havoc with "session" cookies that are used for
authentication or entitlement stuff...
Comment 6 Sebb 2005-06-13 15:11:01 UTC
Thanks for the update - I'll have another look at the code with this in mind.
Comment 7 Robin D. Wilson 2005-06-13 20:01:18 UTC
In case it matters, here are few details of my config:

1) I'm testing against "localhost", so the domain name isn't set. (I don't think
this is the problem since I get the cookie for the second request to use, and
don't lose it until the third request I make.)

2) I'm specifically using "SESSION" cookies. My application is setting a session
cookie when I POST a login form, then it sends back a page which causes me to
run some JavaScript, and then perform a "GET" on a secondary "login" page (don't
ask why - it's complicated and part of a legacy application). The secondary
login page uses the session cookie along with 3 more session cookies.

3) This fails after the 2nd request (to the JavaScript defined page).

4) It fails even when I'm using the "HTTP Proxy" server setup in the
workbench... I cannot get fully logged into the application I'm testing through
JMeter.

5) The application works fine outside of JMeter. I can see the cookies being set
(I use Firefox, and it pops a prompt for each cookie being set).

6) The application works fine if I use the "tcp_mon" tool in a "proxy" mode as well.

7) I have setup a "thread", followed by HTTP Cookie Manager, then my HTTP
Requests, and a Tree listener. I've also tried it with HTTP Header Manager in
the mix, and I've tried running through the proxy to get all of the requests
setup... None of that works I see the requests popping, but the app reports that
the user is not logged in after the first page POSTs...
Comment 8 Sebb 2005-06-17 02:37:59 UTC
I've added yet more debug to the code (in the latest nightly build)

To enable it, use the command-line flag:

-Ljmeter.protocol.http.control.CookieManager=DEBUG

or the equivalent in jmeter.properties:

log_level.jmeter.protocol.http.control.CookieManager=DEBUG

Does that help in tracing the problem?
Comment 9 Sebb 2006-05-05 01:29:40 UTC
As far as I know, this is working in the current 2.1 code
Comment 10 The ASF infrastructure team 2022-09-24 20:37:35 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/1544