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.
Can you post details of the Cookie that is being dropped? In particular, what is the Expiration value?
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...
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).
Have the fixes helped?
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...
Thanks for the update - I'll have another look at the code with this in mind.
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...
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?
As far as I know, this is working in the current 2.1 code
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/1544