[prev in list] [next in list] [prev in thread] [next in thread]
List: apache-cvs
Subject: cvs commit: httpd-2.0/modules/experimental mod_mem_cache.c
From: stoddard () apache ! org
Date: 2003-12-18 21:22:41
[Download RAW message or body]
stoddard 2003/12/18 13:22:41
Modified: . CHANGES
modules/experimental mod_mem_cache.c
Log:
Fix segfault in mod_mem_cache when caching streaming dynamic content.
PR: 21285, 21287
Revision Changes Path
1.1348 +3 -0 httpd-2.0/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/httpd-2.0/CHANGES,v
retrieving revision 1.1347
retrieving revision 1.1348
diff -u -r1.1347 -r1.1348
--- CHANGES 18 Dec 2003 15:29:41 -0000 1.1347
+++ CHANGES 18 Dec 2003 21:22:40 -0000 1.1348
@@ -1,6 +1,9 @@
Changes with Apache 2.1.0-dev
[Remove entries to the current 2.0 section below, when backported]
+ *) Fix segfault in mod_mem_cache cache_insert() due to cache size
+ becoming negative. PR: 21285, 21287
+ [Bill Stoddard, Massimo Torquati, Jean-Jacques Clar]
*) Add Polish translation of error messages. PR 25101.
[Tomasz Kepczynski <tomek jot23.org>]
1.100 +22 -1 httpd-2.0/modules/experimental/mod_mem_cache.c
Index: mod_mem_cache.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_mem_cache.c,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -r1.99 -r1.100
--- mod_mem_cache.c 10 Dec 2003 03:22:32 -0000 1.99
+++ mod_mem_cache.c 18 Dec 2003 21:22:41 -0000 1.100
@@ -1043,7 +1043,28 @@
if (sconf->lock) {
apr_thread_mutex_lock(sconf->lock);
}
- cache_remove(sconf->cache_cache, obj);
+ if (obj->cleanup) {
+ /* If obj->cleanup is set, the object has been prematurly
+ * ejected from the cache by the garbage collector. Add the
+ * object back to the cache. If an object with the same key is
+ * found in the cache, eject it in favor of the completed obj.
+ */
+ cache_object_t *tmp_obj =
+ (cache_object_t *) cache_find(sconf->cache_cache, obj->key);
+ if (tmp_obj) {
+ cache_remove(sconf->cache_cache, tmp_obj);
+ sconf->object_cnt--;
+ sconf->cache_size -= mobj->m_len;
+ tmp_obj->cleanup = 1;
+ if (!tmp_obj->refcount) {
+ cleanup_cache_object(tmp_obj);
+ }
+ }
+ obj->cleanup = 0;
+ }
+ else {
+ cache_remove(sconf->cache_cache, obj);
+ }
mobj->m_len = obj->count;
cache_insert(sconf->cache_cache, obj);
sconf->cache_size -= (mobj->m_len - obj->count);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic