https://issues.apache.org/bugzilla/show_bug.cgi?id=50317

--- Comment #41 from Ruediger Pluem <[email protected]> ---
(In reply to jkaluza from comment #38)
> No, it doesn't. "key" is still NULL even when "accept-encodingURL" is
> locked, so ap_cache_try_lock(...) generates new key without
> "accept-encoding" leading to second lock and second request to backend.

Can you please try the following patch instead?

Index: modules/cache/mod_cache.c
===================================================================
--- modules/cache/mod_cache.c   (revision 1595827)
+++ modules/cache/mod_cache.c   (working copy)
@@ -113,7 +113,27 @@
     if (rv != OK) {
         if (rv == DECLINED) {
             if (!lookup) {
+                char *key;
+                cache_handle_t *h;

+                /*
+                 * Try to use the key of a possible open but stall cache
+                 * entry if we have one.
+                 */
+                if (cache->handle != NULL) {
+                    h = cache->handle;
+                }
+                else {
+                    h = cache->stale_handle;
+                }
+                if ((h != NULL) &&
+                    (h->cache_obj != NULL) &&
+                    (h->cache_obj->key != NULL)) {
+                    key = apr_pstrdup(r->pool, h->cache_obj->key);
+                }
+                else {
+                    key = NULL;
+                }
                 /* try to obtain a cache lock at this point. if we succeed,
                  * we are the first to try and cache this url. if we fail,
                  * it means someone else is already trying to cache this
@@ -121,7 +141,7 @@
                  * backend without any attempt to cache. this stops
                  * duplicated simultaneous attempts to cache an entity.
                  */
-                rv = ap_cache_try_lock(conf, r, NULL);
+                rv = ap_cache_try_lock(conf, r, key);
                 if (APR_SUCCESS == rv) {

                     /*

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to