Bugzilla Defect #21285
This is a rework of the already posted patch.
 
It address the following situation;
1- request comes in for streaming response
2- before that request could be completed, the entry is ejected from the cache
3- when completing the write body step, the incomplete entry is removed
before inserting the correct entry.
 
The problem is that the incomplete entry was already removed/replaced
in the cache. The cache_remove() will then seg fault.
I don't think it has something to do with the cache size has stated
in the bug description. I will follow with a patch removing the deprecated
cache_size and object_cnt from the mem_cache_conf struct.
 
@@ -1043,7 +1044,18 @@
      if (sconf->lock) {
          apr_thread_mutex_lock(sconf->lock);
      }
-     cache_remove(sconf->cache_cache, obj);
+    /* We need to check if the object has been removed/replaced
+     * from/in the cache, this could happen in some cases, because
+     * the current request is a streaming response that is handled
+     * in multiple individual pieces. - fixing Bugzilla Defect 21285
+     */
+    if((tmp_obj = (cache_object_t *) cache_find(sconf->cache_cache, obj->key)) &&
+        (tmp_obj == obj)) {
+                 cache_remove(sconf->cache_cache, obj);
+    }
+    else {
+     obj->cleanup = 0;
+    }
I added the patch to the bug list of attachment.
 
Thank you,
 
Jean-Jacques

Attachment: mod_mem_cache.d21285.patch
Description: Binary data

Reply via email to