Bug 51752 - HTTP Cache is broken when using "Retrieve all embedded resources" with concurrent pool
Summary: HTTP Cache is broken when using "Retrieve all embedded resources" with concur...
Alias: None
Product: JMeter
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 2.5
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
Depends on:
Blocks: 51916
  Show dependency tree
Reported: 2011-09-01 12:06 UTC by shmulikk
Modified: 2011-09-29 13:13 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description shmulikk 2011-09-01 12:06:04 UTC
HTTP Cache is working fine for HTTP Request Sampler and for all of the embedded resources.
When enabling concurrent thread pool for "Retrieve all embedded resources" the requests are being sent without the relevant cache headers.

Probably got to do with the cache info being saved on the requesting thread which probably exits after getting all embedded resources (this is occurring also with only one thread in the concurrent thread pool).

This happens with any HttpClient or JAVAImpl.
Comment 1 shmulikk 2011-09-07 12:53:25 UTC
Caused by current implementation of CacheManager, which using ThreadLocal to separate Cache for each thread(virtual user).

This is causing to separate the Cache to each thread in the concurrent pool, thus breaking the cache.

Currently in CacheManager.java:
private transient ThreadLocal<Map<String, CacheEntry>> threadCache;

Suggested solution:
Removing ThreadLocal from the code.
Changing the key to include the url (current key) + ThreadName.
Comment 2 Milamber 2011-09-07 13:27:07 UTC
Good catch. Thanks for report.
Fixed with InheritableThreadLocal (concurrent threads pool are chlidren of main http request/virtual user)

URL: http://svn.apache.org/viewvc?rev=1166165&view=rev
Bug 51752 - HTTP Cache is broken when using "Retrieve all embedded resources" with concurrent pool

Comment 3 Milamber 2011-09-07 13:42:28 UTC
Not good. Don't works with several loops (works only on same loop for same embebbed resources)

Need some additionnal works
Comment 4 Milamber 2011-09-07 13:45:16 UTC
Oups !!!
Works with loops, I forget to unchecked "Clear cache each iteration?" on HTTP Cache manager on my test plan.

Sorry from SPAM.